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
This commit is contained in:
parent
6a11e0c5c7
commit
0aa06134c6
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user