I am trying to get specific variables from a specific group, but it seems to lead me to strange results.
An example host file:
[server_machine]
zeus account=app1
[agent_machine]
machine1 account=agent port_a=1000 port_b=1001
machine2 account=agent port_a=1200 port_b=1201
machine3 account=agent port_a=1300 port_b=1301
What I'm trying to do is run a script in a group server_machinewith the parameters that I get from the group agent_machines.
Thus, the script will run 3 times on server_machinewith all port combinations.
So basically I need a playbook that might look like this:
- hosts: server_machine
- tasks:
- command: test.py --port_1 {{item}} --port_2 {{item}}
with_items:{{group.agent_machine.port_a, group.agent_machine.port_b }}
However, I cannot get it to work.
source
share