diff options
| author | SamYaple <sam@yaple.net> | 2016-01-05 19:16:48 +0000 |
|---|---|---|
| committer | SamYaple <sam@yaple.net> | 2016-01-05 19:16:48 +0000 |
| commit | f66d1fa70922cb8b40d3d59acf9f7ebcd5110b61 (patch) | |
| tree | 3cc081aad6ef4ca0097f6941ab477195c1f96b9c | |
| parent | f5f925d2ec9c2dcd9379217ff2d15543217bcdc9 (diff) | |
| download | kolla-f66d1fa70922cb8b40d3d59acf9f7ebcd5110b61.tar.gz kolla-f66d1fa70922cb8b40d3d59acf9f7ebcd5110b61.zip | |
Simulate normal ansible behaviour with shared role
By default, if the same role is called in ansible it will only run
once per node. Due to how we have the inventory setup ansible views
every service as a different node and will try to run the common role
tasks again. This causes slowdown in all cases but is particularly
noticable when pulling images. A small change will ensure these tasks
only run once per node per run as originally intended.
TrivialFix
Change-Id: I20b9c46991d10176c8f8645a335eb7a9ed750ee3
| -rw-r--r-- | ansible/roles/common/defaults/main.yml | 4 | ||||
| -rw-r--r-- | ansible/roles/common/tasks/main.yml | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/ansible/roles/common/defaults/main.yml b/ansible/roles/common/defaults/main.yml index 0ba35bcb8..e3895f118 100644 --- a/ansible/roles/common/defaults/main.yml +++ b/ansible/roles/common/defaults/main.yml @@ -1,4 +1,8 @@ --- +# Due to the way we do our inventory, ansible does not pick up on the fact that +# this role has already run. We can track what has run with host facts. +common_run: False + #################### # Docker #################### diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml index b017e8b4a..e261f83ee 100644 --- a/ansible/roles/common/tasks/main.yml +++ b/ansible/roles/common/tasks/main.yml @@ -1,2 +1,8 @@ --- - include: "{{ action }}.yml" + when: not common_run + +- name: Registering common role has run + set_fact: + common_run: True + when: not common_run |
