Here's one possible way (untested so might have a small typo or something) - name: assume no bnx2 modules set_fact: bnx2=no
- name: flag we have a bnx2 module if we find any set_fact: bnx2=yes when: hostvars[inventory_hostname]['ansible_' + item]['module'] == 'bnx' with_items: ansible_interfaces - name: do the thing shell: echo thing when: bnx2 == 'yes' On Thu, Dec 5, 2013 at 5:27 PM, Gonzalo Servat <[email protected]> wrote: > Hi All, > > Say I have the following facts for a server (relevant parts): > > ansibletest | success >> { > "ansible_facts": { > "ansible_em1": { > "module": "bnx2", > }, > "ansible_em2": { > "module": "tg2", > }, > "ansible_em3": { > "module": "bnx2", > } > } > } > > Say I only want to run a task *once and only once* IF at least one > interface is running the module "bnx2". How would you do it? > > GS > > -- > 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. > -- Michael DeHaan <[email protected]> CTO, AnsibleWorks, Inc. http://www.ansibleworks.com/ -- 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.
