Skip to content

Using was installer with Ansible

Dimos Varounis edited this page Dec 16, 2019 · 1 revision

You may run the was-installer tool within an Ansible playbook for EAR deployments:

For example you may use the following playbook templates to run it:

ansible_home/group_vars/my-was-cell

 ---
 binariesdir: /home/was1/bin/binaries
 wasprofilebin: /opt/ibm/websphere/appserver/profiles/Dmgr01/bin
 was_orb_port: 9809
 topologyxmlfile: /home/was1/bin/topology.xml
 logs_dir: /home/was1/logs

ear-deployment.yml

---
- hosts: my-was-cell
  remote_user: ansible
  vars_prompt:
    - name: "wasusername"
      prompt: "WAS username"
      private: no
    - name: "waspasswd"
      prompt: "WAS password"
      private: yes
  tasks:
    - import_tasks: deploy-ear-files.yml
      tags: [deploy]

deploy-ear-files.yml

 ---
 - name: Create "{{ logs_dir }}" dir
   file:
     path: "{{ logs_dir }}"
     owner: was1
     group: wasgroup
     state: directory
     mode: 0755
 - name: Deploy EAR files to specific WAS Cell
   shell: "{{ wasprofilebin }}/wsadmin.sh -lang jython -conntype RMI -user {{ wasusername }} -password {{ waspasswd }} -port {{ was_orb_port }} -javaoption \"-Xms256m -Xmx4096m\" -f /home/was1/bin/installer.py {{ binariesdir }} {{ topologyxmlfile }}| tee -a {{ logs_dir }}/installer.$$.log"
   register: wsadout
   failed_when: "'WASX7209I: Connected to process' not in wsadout.stdout"
   become_user: was1
Clone this wiki locally