Re: [ansible-project] Is there a way to dynamically target subsets of an inventory group based on facts?

2014-09-12 Thread Willard Dennis
Sorry Michael, I will try to be more clear. I am running Ansible 1.7.1 currently. So my original site.yml is this: $ cat site.yml.orig --- - include: dept1-servers.yml - include: dept2-servers.yml - include: base-static-setup.yml ...which works fine. The one producing the traceback is this:

Re: [ansible-project] Is there a way to dynamically target subsets of an inventory group based on facts?

2014-09-12 Thread Michael DeHaan
I'm unclear what you meant by "can I do X" specifically, what that meant you could or couldn't do. A traceback in ansible is a bug though, so please figure out what the minimum way to reproduce that is and file a ticket (provided you are using at least 1.7.1 already and it can be reproduced there)

Re: [ansible-project] Is there a way to dynamically target subsets of an inventory group based on facts?

2014-09-12 Thread Willard Dennis
Hmmm, I guess not... $ ansible-playbook -i temp-stor-inv -u root -k site.yml --tags=mailserver -e "distro=os-Fedora-20" SSH password: Traceback (most recent call last): File "/usr/bin/ansible-playbook", line 309, in sys.exit(main(sys.argv[1:])) File "/usr/bin/ansible-playbook", line 191

Re: [ansible-project] Is there a way to dynamically target subsets of an inventory group based on facts?

2014-09-12 Thread Willard Dennis
Thanks, Michael! But can I do the following? $ cat site.yml --- - hosts: all tasks: # Set up OS-specific groups - group_by: key=os-{{ansible_distribution}}-{{ansible_distribution_version}} - hosts: "{{ distro | default('all') }}" include: - dept1-servers.yml - dept2-servers.yml - b

Re: [ansible-project] Is there a way to dynamically target subsets of an inventory group based on facts?

2014-09-12 Thread Michael DeHaan
Sorry in the above, the word "distro" should be "pattern". On Fri, Sep 12, 2014 at 11:42 AM, Michael DeHaan wrote: > You can't use group_by stuff at that point because it hasn't run yet, > true, but there is a solution to what you would like to do, using two plays > in the same playbook > > -

Re: [ansible-project] Is there a way to dynamically target subsets of an inventory group based on facts?

2014-09-12 Thread Michael DeHaan
You can't use group_by stuff at that point because it hasn't run yet, true, but there is a solution to what you would like to do, using two plays in the same playbook - hosts: all tasks: - group_by: key=os-{{ ansible_distribution }} - hosts: "{{ distro | default('all') }}" tasks: -

Re: [ansible-project] Is there a way to dynamically target subsets of an inventory group based on facts?

2014-09-12 Thread Serge van Ginderachter
On 12 September 2014 16:48, Willard Dennis wrote: > So am I doing this incorrectly, or for some reason, is the "os-Fedora" > group empty? (i.e. the logic is not matching any hosts) ​The --limit happens early, at initialization​, and at that time the group is indeed empty. AFAIK, there is no w

[ansible-project] Is there a way to dynamically target subsets of an inventory group based on facts?

2014-09-12 Thread Willard Dennis
Hi all, I have an inventory file with hosts in different groups within. I would like to run a playbook on a certain group, but only where the host members of that group that have a certain OS (say, " ansible_distribution='Fedora' ".) I was told to look at the "group_by" module, and so in my top