I created a playbook with 6 different tasks and want to run tasks 1,2,3 only when host is a child of was855node
group (e.g. b
, c
) and tasks 4,5 to run only when hosts is child of was855dmgr
group (e.g. a
)
My inventory file:
[local-linux:children]
was855
[was855:children]
was855dmgr
was855node
[was855dmgr:children]
hppidc-pps-dmgr
hppndc-pps-dmgr
hppb-pps-dmgr
**hreg1-mnp-dmgr**
[was855node:children]
wppdev3-pps-node
hint1-pps-node
**hreg1-mnp-node**
[hreg1-mnp-dmgr]
a
[hreg1-mnp-node]
b
c
is this the correct way to do it?
- name: Run create-app-logs.py on the Nodes ***(i want to run it on a ONLY)***
shell: "{{ was_profile_path }}/bin/wsadmin.sh -lang jython -f {{ build_scripts_dir }}/create-app-logs.py"
register: r
when: "'was855dmgr' in group_names"
tags: create_app_logs
- name: Create shared libraries directory ***(i want to run it on b and c ONLY)***
file: path={{ was_shared_lib_location }} state=directory owner=wasadm group=apps mode=0755
when: "'was855node' in group_names"