We broke down our giant ansible workspace into individual, simple roles that can be run on their own. They all depend on our yum role that provisions repositories, etc, and all the roles (A, B, C) have it listed in their meta.yml
:
./roles_galaxy/A/meta/main.yml:
dependencies:
- name: yum-repo
src: foo
./roles_galaxy/B/meta/main.yml:
dependencies:
- name: yum-repo
src: foo
./roles_galaxy/C/meta/main.yml:
dependencies:
- name: yum-repo
src: foo
However, this causes the yum-repo role to be executed multiple times when our deploy playbook is run, so we see multiple executions of the yum-repo
role. We don't want it to do this, as it just takes up extra time and runs repeatedly:
Playbook:
- name: Common Roles
hosts: things
roles:
- A
- B
- C
Output:
PLAY [Role A]
...
TASK [yum-repo ...]
PLAY [Role B]
...
TASK [yum-repo ...]
PLAY [Role C]
...
TASK [yum-repo ...]
I've tried allow_duplicates = false
in our ansible.cfg
, but I don't think that's the right solution as it still executes multiple times.
If there's more information needed, I'm more than happy to try to provide a cleaned up version of it. Running ansible-2.5.5 currently.