Hi all,
I have a dictionary on my site_vars.yml something like this:
services:
- name: "service1"
...
foo: "bar"
The playbook calls the role:
- name: Configure backend
hosts: backend
gather_facts: true
become: yes
roles:
- { role: myrole, type: 'bar' }
And on the tasks main.yml
- name: do stuff
file: path=/var/www/html/{{ item.name }} state=directory
with_items: "{{ services }}"
when: type == "bar" and item.foo == "bar"
I am aware this is not elegante. What I would like to do is to have a task
which will only execute when the type passed from the invocation of the
role matches the value of the variable foo. I tried a couple of with_x
alternatives, but as I don't know the order with which when and with_items
executes, I'm stuck.
Can anyone chip in with a solution to this basic problem?
Thanks,
Miguel
--
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/7701db90-4a6a-43af-8f8b-7c4e4bd6eb80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.