tripleo-upgrade/tasks/common/queens_to_rocky_adjust_nic_...

43 lines
1.5 KiB
YAML

---
- name: look for network software config
shell: |
grep "OS::TripleO::.*::Net::SoftwareConfig" {{ item }}
ignore_errors: true
register: nic_config_envs
with_items:
- "{{ initial_env_file.stdout_lines }}"
- name: set nic_config_env fact
set_fact:
nic_config_env: "{{ item.item }}"
when: item.stdout|length > 0
with_items:
- "{{ nic_config_envs.results }}"
- block:
- name: register nic templates files defined in the environment file
shell: |
set -o pipefail
awk -F': ' '/OS::TripleO::.*::Net::SoftwareConfig/ {print $2}' {{ nic_config_env }}
register: nic_template_files
- name: add Rocky specific parameters to NICs
vars:
relative_path: "{{ '/'.join(nic_config_env.split('/')[0:-1]) + '/' + item }}"
nic_path: "{{ (item[0] == '/')|ternary(item, relative_path) }}"
shell: |
set -o pipefail
NIC_ROLE_NAME=$( grep {{ item }} {{ nic_config_env }} | awk -F '::' '{ print $3 }' );
python /usr/share/openstack-tripleo-heat-templates/tools/merge-new-params-nic-config-script.py \
--tht-dir {{ tht_directory }} \
--role-name $NIC_ROLE_NAME \
--roles-data {{ roles_data }} \
--discard-comments yes \
--template {{ nic_path }}
when:
- "(item[0] == '/' and tht_directory not in item) or (item[0] != '/' and tht_directory not in '/'.join(nic_config_env.split('/')[0:-1]))"
with_items:
- "{{ nic_template_files.stdout_lines }}"
when: nic_config_env is defined