Browse Source

Handle network config override

It was earlier possible to override network config
for undercloud with a custom config using
``net_config_override`` in undercloud.conf or with
``UndercloudNetConfigOverride`` parameter. Though it's
now possible to change ``UndercloudNetworkConfigTemplate``
parameter to override the default config, we probably
still need to support``net_config_override`` and
``UndercloudNetConfigOverride`` for backward compatibility.

Closes-Bug: #1915585
Depends-On: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/775471
Change-Id: Ied2caf9cd5c1b14d30d0badb4e949f620263c96e
changes/72/775472/1
ramishra 10 months ago
parent
commit
551b7528c8
  1. 1
      tripleo_ansible/roles/tripleo_network_config/defaults/main.yml
  2. 21
      tripleo_ansible/roles/tripleo_network_config/tasks/os_net_config.yml

1
tripleo_ansible/roles/tripleo_network_config/defaults/main.yml

@ -31,3 +31,4 @@ tripleo_network_config_os_net_config_mappings: {}
tripleo_network_config_safe_defaults: true
tripleo_network_config_with_ansible: false
tripleo_network_config_template: templates/single_nic_vlan.j2
tripleo_network_config_override: {}

21
tripleo_ansible/roles/tripleo_network_config/tasks/os_net_config.yml

@ -22,7 +22,18 @@
block:
- name: Set nic_config_file fact
set_fact:
nic_config_file: "{{ (tripleo_network_config_with_ansible|bool) | ternary('/etc/os-net-config/config.yaml', '/etc/os-net-config/config.json') }}"
nic_config_file: "{{ (tripleo_network_config_with_ansible|bool) \
| ternary('/etc/os-net-config/config.yaml', \
'/etc/os-net-config/config.json') }}"
- name: Render overidden network config
no_log: "{{ tripleo_network_config_hide_sensitive_logs | bool }}"
copy:
content: "{{tripleo_network_config_override | to_yaml}}"
dest: "{{ nic_config_file }}"
mode: 0600
backup: true
when:
- tripleo_network_config_override.keys()|length > 0
- name: Render network_config
no_log: "{{ tripleo_network_config_hide_sensitive_logs | bool }}"
template:
@ -30,7 +41,9 @@
dest: "{{ nic_config_file }}"
mode: 0600
backup: true
when: not tripleo_network_config_with_ansible|bool
when:
- not tripleo_network_config_with_ansible|bool
- tripleo_network_config_override.keys()|length == 0
- name: Render network_config from template
no_log: "{{ tripleo_network_config_hide_sensitive_logs | bool }}"
template:
@ -38,7 +51,9 @@
dest: "{{ nic_config_file }}"
mode: 0600
backup: true
when: tripleo_network_config_with_ansible|bool
when:
- tripleo_network_config_with_ansible|bool
- tripleo_network_config_override.keys()|length == 0
- name: Run tripleo_os_net_config_module with network_config
tripleo_os_net_config:
config_file: "{{ nic_config_file }}"

Loading…
Cancel
Save