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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/19f18258-213d-4117-a886-7096714d2ea3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to