HI ,
I have my inventory file like below , where I am using the variables primaryNode, secondaryNode in the roles so that particular role will run on the host specified infront of ansible_host values.
Now, how can i pass multiple hosts in the inventory under secondaryNode so that role2 will run on all those nodes one by one. and I will not need to create role3 or role 4 for those.
inventory file
all:
children:
ha:
hosts:
primaryNode:
ansible_host: domain.net1
secondaryNode:
ansible_host: domain.net2
my yaml looks liike elow :
23456789101112131415161718192021222324
---- name: Installing primary node hosts: primaryNode become: True roles:
- role: role1
- name: Installing secondary node hosts: secondaryNode become: True roles:
- role: role2