On 22.04.16 16:42 Pogan wrote: > I forgot to mention that idea is to do this through host variable file, and > not through playbook itself. > Set a variable called bar for this host foo in the host_vars/foo file and only execute the task, when this variable is not set:
- hosts: mailservers
tasks:
- name: Check amavis service, and start if needed.
service: name=amavis state=started
when: hostvars[foo]['bar']|default('') is undefined
I'm not sure what exactly has to be inside the default, but using
default avoids errors when the variable bar is undefined...
Johannes
--
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/571A6FBB.6070208%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: OpenPGP digital signature
