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.
For more options, visit https://groups.google.com/d/optout.