Hi all, I'm pretty new to Ansible but trying to learn quickly. I was
building a role and wanted to perform a check for required variables, and
was trying to put them in a loop instead of individually. Here is what I
am trying but I keep getting errors:
- name: Check for requirement variables
fail: msg="Bailing out. This role requires {{ item }}"
when: {{ item }} is undefined
with_items:
- nginx_domain
- nginx_port
Instead of having declare them individually like this:
- name: Check for requirement nginx_domain
fail: msg="Bailing out. This role requires 'nginx_domain'"
when: nginx_domain is undefined
- name: Check for requirement nginx_port
fail: msg="Bailing out. This role requires 'nginx_port'"
when: nginx_domain is undefined
Is this possible? Or am I trying to fit a square peg in a round hole?
Thanks for any feedback
-- BrianH
--
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/f295241a-38dc-4ba9-ac7a-b09043d6a413%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.