tripleo-upgrade/tasks/common/queens_to_rocky_adjust_nic_templates.yaml
Sorin Sbarnea 8ac74a8177 Migrate linting to pre-commit
Follows the same linting configuration that was implemented first in
tripleo-quickstart-extras which makes used of pre-commit tool for
managing all linters.

This also avoids problems where a new linter release may break our
gates because pre-commit always pins versions.

Removes ansible from requirements.txt as it needs to be listed only
in ansible-requirements.txt

Change-Id: Ia229d3d58763d743bd19ad9099d7907561f3c77f
Depends-On: https://review.openstack.org/#/c/626000/
2018-12-19 19:25:13 +01:00

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