Browse Source

Merge "Handle network config override"

changes/57/771657/28
Zuul 2 months ago
committed by Gerrit Code Review
parent
commit
32f7a3d211
2 changed files with 19 additions and 3 deletions
  1. +1
    -0
      tripleo_ansible/roles/tripleo_network_config/defaults/main.yml
  2. +18
    -3
      tripleo_ansible/roles/tripleo_network_config/tasks/os_net_config.yml

+ 1
- 0
tripleo_ansible/roles/tripleo_network_config/defaults/main.yml View File

@ -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: {}

+ 18
- 3
tripleo_ansible/roles/tripleo_network_config/tasks/os_net_config.yml View File

@ -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