There is a master/slave setup.
Goal:
Set {{ other_host_of_play }} in a jinja2 template. Example;
The content of node1 should contain node2
Tried {{ play_hosts[0] }}, but this sets the first host of the play, instead of the 'other host'.
There is a master/slave setup.
Goal:
Set {{ other_host_of_play }} in a jinja2 template. Example;
The content of node1 should contain node2
Tried {{ play_hosts[0] }}, but this sets the first host of the play, instead of the 'other host'.
Not sure if I am allowed to do this. But the answer was actually in the post @konstantinSuvorov provided.
{{ play_hosts | difference([inventory_hostname]) }}
How to remove or exclude an item in an Ansible template list?