Hi Michael,
I am not sure how would "or" work (though I have tried and it doesn't) over here. Generally, statement is true in 'and' clause when both the conditions are true, which are true in this case.
root@ansible:~# ansible box92.test.com -m setup | egrep -w 'ansible_os_family|ansible_distribution'
"ansible_distribution": "Ubuntu",
"ansible_os_family": "Debian",
root@ansible:~#
root@ansible:~# ansible box93.test.com -m setup | egrep -w 'ansible_os_family|ansible_distribution'
"ansible_distribution": "Debian",
"ansible_os_family": "Debian",
root@ansible:~#
I have two Debian based distros - Ubuntu 14.04 and Debian 7.40
Ideally,
- include: Ubuntu.yml
when: ansible_os_family == "Debian" and ansible_distribution == "Ubuntu" (Should pick up vars/Ubuntu.yml)
- include: Debian.yml
when: ansible_os_family == "Debian" and ansible_distribution == "Debian" (Should pick up vars/Debian.yml)
I even tried this, but still Ansible pick up variables defined in vars/Debian.yml :(
- include: Ubuntu.yml
when: ansible_distribution == "Ubuntu"
- include: Debian.yml
when: ansible_distribution == "Debian"
Or is it ansible only works with '
ansible_os_family' fact.
Is there an alternative to do this ?
Regards,
Vikas