Hi Vasek

You can declare dynamic groups based on arbitrary facts, and then apply
tasks or roles to those groups. There is an example at
http://docs.ansible.com/playbooks_best_practices.html#operating-system-and-distribution-variance
which seems to do exactly what you want.

Regards
Tom


On 7 January 2015 at 13:43, Vaclav Adamec <vaclav.ada...@suchy-zleb.cz>
wrote:

> Hi,
>  can humbly ask someone to provide me some example how to filter list of
> servers with facts ? I probably miss something in documentation, I need
> something like this:
>
> ansible -i /usr/local/src/ansible/plugins/inventory/vmware.py '~web.*' -m
> shell -a 'filter=facter_operatingsystem_CentOS' -a "some fancy command"
>
> and in playbook this:
>
>   - name: Test
>     script: ./script.sh
>     register: command_result
>     failed_when: "'FAILED' in command_result.stdout"
>     when: facter_operatingsystem|CentOS
>
> Thanks a lot
>
> Vasek
>
>  --
> 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/fc6d5020-927f-4cf0-a04c-604542b7d952%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/fc6d5020-927f-4cf0-a04c-604542b7d952%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAAnNz0Ngh8994tu_mvzTxh6wF3Vf16WniE76qPjQgU7osTAX%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to