SWEET! Thanks mate!

On Friday, May 20, 2016 at 10:48:42 AM UTC+8, Matt Martz wrote:
>
> Check out with_inventory_hostnames
>
>
> http://docs.ansible.com/ansible/playbooks_loops.html#looping-over-the-inventory
>
> On Thursday, May 19, 2016, jzarzoso <[email protected] <javascript:>> wrote:
>
>> Hi everyone!
>>
>> I'm thinking of looping through all the hosts from a playbook with a 
>> pattern. I have this play:
>>
>> - hosts: localhost # Select all hosts
>>   tasks:
>>     - name: Debug the list
>>       debug: 
>>         msg: "host: {{ item }}"
>>       with_items: "{{groups.all}}"
>>
>> I wanted something like this:
>>
>> - hosts: localhost # Select all hosts EXCEPT localhost
>>   tasks:
>>     - name: Debug the list
>>       debug: 
>>         msg: "host: {{ item }}"
>>       with_items: "{{ groups.all:!localhost }}"
>>
>>
>> I tried but I got an error: 
>>
>> fatal: [localhost]: FAILED! => {"failed": true, "msg": "template error 
>> while templating string: expected token 'end of print statement', got ':'. 
>> String: {{groups.all:!localhost}}"}
>>
>>
>> -- 
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/8f8c3e61-f670-45d5-879e-9cdb781afab6%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/8f8c3e61-f670-45d5-879e-9cdb781afab6%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3a85f9a1-7994-4e04-8dc4-0987f6f033bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to