Avoid launching "local" actions too many times

In order to speed up deployment time some "local" actions should be run
only once using 'run_once: True'.
This will decrease deployment time in case of multihost configuration.

Change-Id: I6015d772d35c15e96c52f577013b6e41197cb41a
This commit is contained in:
Bertrand Lallau 2017-07-04 18:22:55 +02:00
parent 8f3f675b84
commit a9113fc466
36 changed files with 40 additions and 0 deletions

View File

@ -63,6 +63,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/aodh/policy.json" local_action: stat path="{{ node_custom_config }}/aodh/policy.json"
run_once: True
register: aodh_policy register: aodh_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -76,6 +76,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/barbican/policy.json" local_action: stat path="{{ node_custom_config }}/barbican/policy.json"
run_once: True
register: barbican_policy register: barbican_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -109,6 +109,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/ceilometer/policy.json" local_action: stat path="{{ node_custom_config }}/ceilometer/policy.json"
run_once: True
register: ceilometer_policy register: ceilometer_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -2,6 +2,7 @@
- name: Check whether the swift service is enabled - name: Check whether the swift service is enabled
local_action: fail msg='Ceph-rgw-keystone is conflicted with swift, you should only enable one of them' local_action: fail msg='Ceph-rgw-keystone is conflicted with swift, you should only enable one of them'
when: enable_swift | bool when: enable_swift | bool
run_once: True
- name: Creating the Swift service and endpoint - name: Creating the Swift service and endpoint
kolla_toolbox: kolla_toolbox:

View File

@ -69,6 +69,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/cinder/policy.json" local_action: stat path="{{ node_custom_config }}/cinder/policy.json"
run_once: True
register: cinder_policy register: cinder_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -46,6 +46,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/cloudkitty/policy.json" local_action: stat path="{{ node_custom_config }}/cloudkitty/policy.json"
run_once: True
register: cloudkitty_policy register: cloudkitty_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -42,6 +42,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/congress/policy.json" local_action: stat path="{{ node_custom_config }}/congress/policy.json"
run_once: True
register: congress_policy register: congress_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -118,6 +118,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/designate/policy.json" local_action: stat path="{{ node_custom_config }}/designate/policy.json"
run_once: True
register: designate_policy register: designate_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -56,6 +56,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_config_directory }}/freezer/policy.json" local_action: stat path="{{ node_config_directory }}/freezer/policy.json"
run_once: True
register: freezer_policy register: freezer_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -46,6 +46,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/glance/policy.json" local_action: stat path="{{ node_custom_config }}/glance/policy.json"
run_once: True
register: glance_policy register: glance_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -63,6 +63,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/gnocchi/policy.json" local_action: stat path="{{ node_custom_config }}/gnocchi/policy.json"
run_once: True
register: gnocchi_policy register: gnocchi_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -55,6 +55,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/heat/policy.json" local_action: stat path="{{ node_custom_config }}/heat/policy.json"
run_once: True
register: heat_policy register: heat_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -58,6 +58,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/horizon/{{ item.name }}_policy.json" local_action: stat path="{{ node_custom_config }}/horizon/{{ item.name }}_policy.json"
run_once: True
register: custom_policy register: custom_policy
when: item.enabled | bool when: item.enabled | bool
with_items: with_items:

View File

@ -83,6 +83,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/ironic/policy.json" local_action: stat path="{{ node_custom_config }}/ironic/policy.json"
run_once: True
register: ironic_policy register: ironic_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -30,6 +30,7 @@
- name: Checking ironic-agent files exist for Ironic - name: Checking ironic-agent files exist for Ironic
local_action: stat path="{{ node_custom_config }}/ironic/{{ item }}" local_action: stat path="{{ node_custom_config }}/ironic/{{ item }}"
run_once: True
register: result register: result
failed_when: not result.stat.exists failed_when: not result.stat.exists
when: when:

View File

@ -1,10 +1,12 @@
--- ---
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/keystone/policy.json" local_action: stat path="{{ node_custom_config }}/keystone/policy.json"
run_once: True
register: keystone_policy register: keystone_policy
- name: Check if Keystone Domain specific settings enabled - name: Check if Keystone Domain specific settings enabled
local_action: stat path="{{ node_custom_config }}/keystone/domains" local_action: stat path="{{ node_custom_config }}/keystone/domains"
run_once: True
register: keystone_domain_directory register: keystone_domain_directory
- name: Ensuring config directories exist - name: Ensuring config directories exist

View File

@ -59,6 +59,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/kuryr/policy.json" local_action: stat path="{{ node_custom_config }}/kuryr/policy.json"
run_once: True
register: kuryr_policy register: kuryr_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -46,6 +46,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/magnum/policy.json" local_action: stat path="{{ node_custom_config }}/magnum/policy.json"
run_once: True
register: magnum_policy register: magnum_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -73,6 +73,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/manila/policy.json" local_action: stat path="{{ node_custom_config }}/manila/policy.json"
run_once: True
register: manila_policy register: manila_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -42,6 +42,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/mistral/policy.json" local_action: stat path="{{ node_custom_config }}/mistral/policy.json"
run_once: True
register: mistral_policy register: mistral_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -35,6 +35,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/murano/policy.json" local_action: stat path="{{ node_custom_config }}/murano/policy.json"
run_once: True
register: murano_policy register: murano_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -265,6 +265,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/neutron/policy.json" local_action: stat path="{{ node_custom_config }}/neutron/policy.json"
run_once: True
register: neutron_policy register: neutron_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -19,6 +19,7 @@
- name: Checking number of network agents - name: Checking number of network agents
local_action: fail msg="Number of network agents are less than two when enabling agent ha" local_action: fail msg="Number of network agents are less than two when enabling agent ha"
changed_when: false changed_when: false
run_once: True
when: when:
- enable_neutron_agent_ha | bool - enable_neutron_agent_ha | bool
- groups['neutron-dhcp-agent'] | length < 2 - groups['neutron-dhcp-agent'] | length < 2

View File

@ -115,6 +115,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/nova/policy.json" local_action: stat path="{{ node_custom_config }}/nova/policy.json"
run_once: True
register: nova_policy register: nova_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -10,12 +10,14 @@
- name: Check nova keyring file - name: Check nova keyring file
local_action: stat path="{{ node_custom_config }}/nova/ceph.client.nova.keyring" local_action: stat path="{{ node_custom_config }}/nova/ceph.client.nova.keyring"
run_once: True
register: nova_cephx_keyring_file register: nova_cephx_keyring_file
failed_when: not nova_cephx_keyring_file.stat.exists failed_when: not nova_cephx_keyring_file.stat.exists
when: external_ceph_cephx_enabled | bool when: external_ceph_cephx_enabled | bool
- name: Check cinder keyring file - name: Check cinder keyring file
local_action: stat path="{{ node_custom_config }}/nova/ceph.client.cinder.keyring" local_action: stat path="{{ node_custom_config }}/nova/ceph.client.cinder.keyring"
run_once: True
register: cinder_cephx_keyring_file register: cinder_cephx_keyring_file
failed_when: not cinder_cephx_keyring_file.stat.exists failed_when: not cinder_cephx_keyring_file.stat.exists
when: when:
@ -61,11 +63,13 @@
- name: Extract nova key from file - name: Extract nova key from file
local_action: shell cat "{{ nova_cephx_keyring_file.stat.path }}" | grep -E 'key\s*=' | awk '{ print $3 }' local_action: shell cat "{{ nova_cephx_keyring_file.stat.path }}" | grep -E 'key\s*=' | awk '{ print $3 }'
run_once: True
register: nova_cephx_raw_key register: nova_cephx_raw_key
when: external_ceph_cephx_enabled | bool when: external_ceph_cephx_enabled | bool
- name: Extract cinder key from file - name: Extract cinder key from file
local_action: shell cat "{{ cinder_cephx_keyring_file.stat.path }}" | grep -E 'key\s*=' | awk '{ print $3 }' local_action: shell cat "{{ cinder_cephx_keyring_file.stat.path }}" | grep -E 'key\s*=' | awk '{ print $3 }'
run_once: True
register: cinder_cephx_raw_key register: cinder_cephx_raw_key
when: when:
- cinder_backend_ceph | bool - cinder_backend_ceph | bool

View File

@ -30,6 +30,7 @@
- name: Checking certificate files exist for octavia - name: Checking certificate files exist for octavia
local_action: stat path="{{ node_custom_config }}/octavia/{{ item }}" local_action: stat path="{{ node_custom_config }}/octavia/{{ item }}"
run_once: True
register: result register: result
failed_when: not result.stat.exists failed_when: not result.stat.exists
when: inventory_hostname in groups['octavia-worker'] when: inventory_hostname in groups['octavia-worker']

View File

@ -59,6 +59,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/panko/policy.json" local_action: stat path="{{ node_custom_config }}/panko/policy.json"
run_once: True
register: panko_policy register: panko_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -8,6 +8,7 @@
- name: Checking empty passwords in passwords.yml. Run kolla-genpwd if this task fails - name: Checking empty passwords in passwords.yml. Run kolla-genpwd if this task fails
local_action: command grep '^[^#].*:\s*$' "{{ CONFIG_DIR | default('/etc/kolla') }}/passwords.yml" local_action: command grep '^[^#].*:\s*$' "{{ CONFIG_DIR | default('/etc/kolla') }}/passwords.yml"
run_once: True
register: result register: result
changed_when: false changed_when: false
failed_when: result.stdout | regex_replace('(.*ssh_key.*)', '') | search(":") failed_when: result.stdout | regex_replace('(.*ssh_key.*)', '') | search(":")

View File

@ -39,6 +39,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/rally/policy.json" local_action: stat path="{{ node_custom_config }}/rally/policy.json"
run_once: True
register: rally_policy register: rally_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -46,6 +46,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/sahara/policy.json" local_action: stat path="{{ node_custom_config }}/sahara/policy.json"
run_once: True
register: sahara_policy register: sahara_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -41,6 +41,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/searchlight/policy.json" local_action: stat path="{{ node_custom_config }}/searchlight/policy.json"
run_once: True
register: searchlight_policy register: searchlight_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -46,6 +46,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/senlin/policy.json" local_action: stat path="{{ node_custom_config }}/senlin/policy.json"
run_once: True
register: senlin_policy register: senlin_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -155,6 +155,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/swift/policy.json" local_action: stat path="{{ node_custom_config }}/swift/policy.json"
run_once: True
register: swift_policy register: swift_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -44,6 +44,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/tacker/policy.json" local_action: stat path="{{ node_custom_config }}/tacker/policy.json"
run_once: True
register: tacker_policy register: tacker_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -48,6 +48,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/watcher/policy.json" local_action: stat path="{{ node_custom_config }}/watcher/policy.json"
run_once: True
register: watcher_policy register: watcher_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json

View File

@ -57,6 +57,7 @@
- name: Check if policies shall be overwritten - name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/zun/policy.json" local_action: stat path="{{ node_custom_config }}/zun/policy.json"
run_once: True
register: zun_policy register: zun_policy
- name: Copying over existing policy.json - name: Copying over existing policy.json