Hi all,
I am having a problem with host classification. In my hosts file i have a “nodejs:children” group with application “foo”. “foo” has server-a. In site.yml I use hosts: nodejs:&{{ application }} and assign a role. This works well with multiple applications until the same server is configured in multiple groups. Then multiple roles are applied. I would expect only 1 role applied. Any idea what is going wrong? Here is the relevant files:
hosts:
[nodejs:children]
foo
[java:children]
bar
[foo]
localhost
[bar]
localhost
site.yml:
---
- name: deploy nodejs app
hosts: nodejs:&{{ application }}
roles:
- nodejs
- name: deploy java app
hosts: java:&{{ application }}
roles:
- java
command:
ansible-playbook site.yml -i hosts --check -e 'application=foo'
Thanks,
Jan