Right now I have yaml that look like:

applications:
  - name: app1
    type: type1
  - name: app2
    type: type2
  - name: app3
    type: type1

With lots of roles that look like this:

- { role: 'type1' }
- { role: 'type2' }
- { role: 'type3' }

And inside these roles on every task I have to do something like this:

- name: task
  with_items: applications
  when: item.type == type1

The issue is that is has to run every one of these roles and all the tasks 
within it. It complicates things having to add the when item.type 
== type1 to every task within the role. I am trying to figure out a way so 
that these roles are not even included if they do not exist in the list. 
Something like:

- { role: 'app1', when: applications|exist('type', 'type1') }

- { role: 'app1', when: applications.type == type1 }

- { role:"{{ item.type }}", data: {{ item }}, with_items: applications, 
when: item.type == type1 }

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

Reply via email to