From 0aa06134c68217ded8486752222a9527a9d99cb8 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Wed, 10 Jul 2019 12:23:59 -0400 Subject: [PATCH] Use template for NetworkConfig script Use the first_found Ansible lookup plugin to look for the NetworkConfig script in both the role directory and server directory. This allows for using a role generic NetworkConfig script in the role dir, while still being backwards compatible. The NetworkConfig script is also rendered from a template on the remote node instead of just copied. Treating it as a template allows it to be made generic per role instead of node specific. Depends-On: I6bbca8eb256f387c4f74378baa5253890cfe1abf Change-Id: Ibbb5dd2ccbdaec083ec636ac44dfdc75b65f89a7 --- common/deploy-steps.j2 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/deploy-steps.j2 b/common/deploy-steps.j2 index 0e4e56936b..96c6844acb 100644 --- a/common/deploy-steps.j2 +++ b/common/deploy-steps.j2 @@ -561,9 +561,13 @@ outputs: - name: Check NetworkConfig script existence local_action: module: stat - path: {{ '"{{' }} tripleo_role_name ~ '/' ~ inventory_hostname ~ '/NetworkConfig' {{ '}}"' }} + path: {{ '"{{' }} lookup('first_found', NetworkConfig_paths, errros='ignore') {{ '}}"' }} become: no register: NetworkConfig_stat + vars: + NetworkConfig_paths: + - {{ '"{{' }} tripleo_role_name ~ '/' ~ inventory_hostname ~ '/NetworkConfig' {{ '}}"' }} + - {{ '"{{' }} tripleo_role_name ~ '/NetworkConfig' {{ '}}"' }} - name: NetworkConfig block: @@ -575,10 +579,10 @@ outputs: selevel: s0 recurse: true - - name: Copy NetworkConfig script - copy: + - name: Render NetworkConfig script + template: dest: /var/lib/tripleo-config/scripts/run_os_net_config.sh - src: {{ '"{{' }} tripleo_role_name ~ '/' ~ inventory_hostname ~ '/NetworkConfig' {{ '}}"' }} + src: {{ '"{{' }} NetworkConfig_stat.stat.path {{ '}}"' }} mode: 0755 - name: Run NetworkConfig script