Run NetworkConfig only if configuration script exists

Script is first located/generated on the undercloud node (aka ansible
host), meaning we have to use local_action.
We also deactivate the "become" in order to avoid useless privilege
escalation.

Change-Id: I8c1ed334dc5b578a87307a47656ee2d87f1e3688
Depends-On: https://review.opendev.org/668560
Related-Bug: #1834094
This commit is contained in:
Cédric Jeanneret 2019-07-02 13:05:31 +02:00
parent 250e172f29
commit c36433e34e
1 changed files with 13 additions and 3 deletions

View File

@ -558,6 +558,13 @@ outputs:
when: os_net_config_returncode_stat.stat.exists
register: os_net_config_returncode_slurp
- name: Check NetworkConfig script existence
local_action:
module: stat
path: {{ '"{{' }} tripleo_role_name ~ '/' ~ inventory_hostname ~ '/NetworkConfig' {{ '}}"' }}
become: no
register: NetworkConfig_stat
- name: NetworkConfig
block:
- name: Create /var/lib/tripleo-config/scripts directory
@ -602,10 +609,13 @@ outputs:
# - Or it has never run
# This will match the prior behavior of when a Heat
# SoftwareDeployment was used.
when: (stack_action == "CREATE") or ("UPDATE" in network_deployment_actions) or
# It also ensures the script does exist as a sine qua non
# condition
when: NetworkConfig_stat.stat.exists and
((stack_action == "CREATE") or ("UPDATE" in network_deployment_actions) or
(os_net_config_returncode_stat.stat.exists and
((os_net_config_returncode_slurp.content | b64decode) != 0)) or
(not os_net_config_returncode_stat.stat.exists)
((os_net_config_returncode_slurp.content | b64decode) != 0)) or
(not os_net_config_returncode_stat.stat.exists))
- name: AllNodesValidationConfig
script: all_nodes_validation_script.sh