Hello!
I have the following group var in group_vars/staging:
jboss_master_host: barad-dur.example.com
And I need to set, for each host in a play, its jboss_host_type = master | slave based on that variable - the jboss_host_type is used in multiple places in templates.
I have found the following solution, adding this to my tasks:
- name: Set jboss_host_type var
set_fact: jboss_host_type={{ ‘master’ if jboss_master_host == inventory_hostname else ‘slave’ }}
The question is, is this the right way to do it? Is there a better way?
Thank you!
PS: Ansible 1.5.3