Add support for setting MTU on veth interfaces

This commit is contained in:
Mark Goddard 2017-11-06 19:19:32 +00:00
parent 8cfa1da254
commit 07733d1aea
3 changed files with 17 additions and 6 deletions

View File

@ -84,23 +84,28 @@
- name: Update a fact containing bridges to be patched to the Neutron OVS bridge - name: Update a fact containing bridges to be patched to the Neutron OVS bridge
set_fact: set_fact:
veth_bridges: > veth_bridges: >
{{ veth_bridges | {{ veth_bridges | union([bridge_obj]) | list }}
union([item | net_interface | replace('.' ~ item | net_vlan | default('!nomatch!'), '')]) |
list }}
with_items: with_items:
- "{{ provision_wl_net_name }}" - "{{ provision_wl_net_name }}"
- "{{ external_net_name }}" - "{{ external_net_name }}"
when: item in network_interfaces when: item in network_interfaces
vars:
interface: "{{ item | net_interface | replace('.' ~ item | net_vlan | default('!nomatch!'), '') }}"
bridge_obj:
interface: "{{ interface }}"
mtu: "{{ item | net_mtu }}"
- name: Update a fact containing veth interfaces - name: Update a fact containing veth interfaces
set_fact: set_fact:
veth_interfaces: > veth_interfaces: >
{{ veth_interfaces + {{ veth_interfaces +
[{'device': network_patch_prefix ~ item ~ network_patch_suffix_phy, [{'device': network_patch_prefix ~ item.interface ~ network_patch_suffix_phy,
'bootproto': 'static', 'bootproto': 'static',
'bridge': item, 'bridge': item.interface,
'peer_device': network_patch_prefix ~ item ~ network_patch_suffix_ovs, 'mtu': item.mtu,
'peer_device': network_patch_prefix ~ item.interface ~ network_patch_suffix_ovs,
'peer_bootproto': 'static', 'peer_bootproto': 'static',
'peer_mtu': item.mtu,
'onboot': 'yes'}] }} 'onboot': 'yes'}] }}
with_items: "{{ veth_bridges }}" with_items: "{{ veth_bridges }}"
roles: roles:

View File

@ -25,3 +25,6 @@ BRIDGE={{ item.peer_bridge }}
{% if ansible_distribution_major_version | int >= 7 %} {% if ansible_distribution_major_version | int >= 7 %}
NM_CONTROLLED=no NM_CONTROLLED=no
{% endif %} {% endif %}
{% if item.peer_mtu is defined and item.peer_mtu %}
MTU={{ item.peer_mtu }}
{% endif %}

View File

@ -25,3 +25,6 @@ BRIDGE={{ item.bridge }}
{% if ansible_distribution_major_version | int >= 7 %} {% if ansible_distribution_major_version | int >= 7 %}
NM_CONTROLLED=no NM_CONTROLLED=no
{% endif %} {% endif %}
{% if item.mtu is defined and item.mtu %}
MTU={{ item.mtu }}
{% endif %}