Add support for network config template
This adds support to use jinja template for network config. Also adds ones to be used with default undercloud and standalone. Though the templates of both undercloud and standalone are almost the same, separate ones are kept as before. If someone wants to override the whole config as supported earlier it can be done by choosing a different template. Change-Id: I16be7ee44af8f52c8ef0705e2ab692148d65bc28
This commit is contained in:
parent
a4d205f378
commit
6f03f83d52
|
@ -30,3 +30,5 @@ tripleo_network_config_manage_service: true
|
|||
tripleo_network_config_network_deployment_actions: []
|
||||
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
|
||||
|
|
|
@ -20,16 +20,28 @@
|
|||
- name: Apply os-net-config configuration
|
||||
become: true
|
||||
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') }}"
|
||||
- name: Render network_config
|
||||
no_log: "{{ tripleo_network_config_hide_sensitive_logs | bool }}"
|
||||
template:
|
||||
src: "{{ tripleo_network_config_script_path }}"
|
||||
dest: /etc/os-net-config/config.json
|
||||
dest: "{{ nic_config_file }}"
|
||||
mode: 0600
|
||||
backup: true
|
||||
when: not tripleo_network_config_with_ansible|bool
|
||||
- name: Render network_config from template
|
||||
no_log: "{{ tripleo_network_config_hide_sensitive_logs | bool }}"
|
||||
template:
|
||||
src: "{{ tripleo_network_config_template }}"
|
||||
dest: "{{ nic_config_file }}"
|
||||
mode: 0600
|
||||
backup: true
|
||||
when: tripleo_network_config_with_ansible|bool
|
||||
- name: Run tripleo_os_net_config_module with network_config
|
||||
tripleo_os_net_config:
|
||||
config_file: /etc/os-net-config/config.json
|
||||
config_file: "{{ nic_config_file }}"
|
||||
debug: "{{ tripleo_network_config_debug|bool }}"
|
||||
detailed_exit_codes: true
|
||||
safe_defaults: "{{ tripleo_network_config_safe_defaults | bool }}"
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
{% set control_virtual_ip = deployed_server_port_map.control_virtual_ip.fixed_ips[0].ip_address %}
|
||||
{% set public_virtual_ip = deployed_server_port_map.public_virtual_ip.fixed_ips[0].ip_address %}
|
||||
{% if ':' in control_virtual_ip %}
|
||||
{% set control_virtual_cidr = 128 %}
|
||||
{% else %}
|
||||
{% set control_virtual_cidr = 32 %}
|
||||
{% endif %}
|
||||
{% if ':' in public_virtual_ip %}
|
||||
{% set public_virtual_cidr = 128 %}
|
||||
{% else %}
|
||||
{% set public_virtual_cidr = 32 %}
|
||||
{% endif %}
|
||||
network_config:
|
||||
- type: ovs_bridge
|
||||
name: br-ctlplane
|
||||
use_dhcp: false
|
||||
mtu: {{ local_mtu }}
|
||||
ovs_extra:
|
||||
- br-set-external-id br-ctlplane bridge-id br-ctlplane
|
||||
addresses:
|
||||
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }}
|
||||
- ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }}
|
||||
- ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }}
|
||||
routes: {{ ctlplane_static_routes }}
|
||||
dns_servers: {{ dns_nameservers }}
|
||||
domain: {{ dns_search_domains }}
|
||||
members:
|
||||
- type: interface
|
||||
name: {{ neutron_public_interface }}
|
||||
primary: true
|
||||
mtu: {{ local_mtu }}
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
{% set control_virtual_ip = deployed_server_port_map.control_virtual_ip.fixed_ips[0].ip_address %}
|
||||
{% set public_virtual_ip = deployed_server_port_map.public_virtual_ip.fixed_ips[0].ip_address %}
|
||||
{% if ':' in control_virtual_ip %}
|
||||
{% set control_virtual_cidr = 128 %}
|
||||
{% else %}
|
||||
{% set control_virtual_cidr = 32 %}
|
||||
{% endif %}
|
||||
{% if ':' in public_virtual_ip %}
|
||||
{% set public_virtual_cidr = 128 %}
|
||||
{% else %}
|
||||
{% set public_virtual_cidr = 32 %}
|
||||
{% endif %}
|
||||
network_config:
|
||||
- type: ovs_bridge
|
||||
name: br-ctlplane
|
||||
use_dhcp: false
|
||||
ovs_extra:
|
||||
- br-set-external-id br-ctlplane bridge-id br-ctlplane
|
||||
addresses:
|
||||
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }}
|
||||
- ip_netmask: {{ control_virtual_ip}}/{{ control_virtual_cidr }}
|
||||
- ip_netmask: {{ public_virtual_ip}}/{{ public_virtual_cidr }}
|
||||
routes: {{ ctlplane_static_routes }}
|
||||
dns_servers: {{ dns_nameservers }}
|
||||
domain: {{ dns_search_domains }}
|
||||
members:
|
||||
- type: interface
|
||||
name: {{ neutron_public_interface }}
|
||||
primary: true
|
||||
mtu: {{ local_mtu }}
|
Loading…
Reference in New Issue