using set_fact that way requires you to check if those vars are defined, i believe this is a better approach:
vars: is_master: "{{ inventory_hostname == master_hostname }}" is_slave: "{{ inventory_hostname == master_hostname }}" then you can just use them direcly in subsequent conditionals: when: is_master|bool There are other approaches as well, i.e using group_by, but I think the one above should work best for you. ---------- Brian Coca -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CACVha7eMHd%2BWdX4fBtKwfHABZHkF8nf-sLYhu9GZTz3QEY3M7Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.