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