Hi,

I have a role that's called from other roles via dependencies. I'm seeing 
the role run twice, as discussed at 
https://groups.google.com/forum/#!searchin/ansible-project/role$20dependencies$20run$20twice/ansible-project/qoC1fVKEm7I/MWDl9ALo-KoJ

I've worked around this by adding the following as the last task of the 
role:

- set_fact: myrole_has_run=true
  when: myrole_has_run is not defined


And then in the meta/defaults.yml:

dependencies:
  - role: myrole
    when: myrole_has_run is not defined

Is there a native way of making sure a role only runs once?

Thanks.
Matt

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9f49e409-a9e3-431d-a418-35ef173db679%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to