zuul-jobs/roles/multi-node-bridge/tasks/common.yaml
Paul Belanger e24fd6b7c0
Switch to centos-release-openstack-queens for ovs
Drop the dependency on RDO infra in favor of latest OVS releases in
centos-7. This means we'll be bumping to 2.9.0.

This still isn't the best, as we are pinning to a specific release of
openstack. However, until there is the OVS SIG in centos, this is the
best we can do.

Change-Id: Ic8a7ee26ebe0ef4f8c2dcecf9bcfce03b55422e5
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2018-07-10 13:02:23 -04:00

88 lines
2.7 KiB
YAML

- name: Include OS-specific variables
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
# CentOS requires repositories provided by centos in order to install
# openvswitch, set them up.
- name: Enable centos-release-openstack-queens
become: yes
package:
name: centos-release-openstack-queens
state: installed
when:
- ansible_os_family == "RedHat"
- ansible_distribution != "Fedora"
register: centos_ovs
- name: Install openvswitch
become: yes
package:
name: "{{ ovs_package }}"
state: installed
- name: Ensure openvswitch is started
become: yes
service:
name: "{{ ovs_service }}"
state: started
enabled: yes
# If we've installed repositories for openvswitch earlier, remove them
- name: Ensure centos-release-openstack-queens is removed
become: yes
package:
name: "centos-release-openstack-queens"
state: absent
when: centos_ovs | changed
- name: Authorize the multi-node-bridge network
become: yes
iptables:
state: present
action: insert
chain: INPUT
ip_version: ipv4
source: "{{ bridge_address_prefix }}.0/{{ bridge_address_subnet }}"
destination: "{{ bridge_address_prefix }}.0/{{ bridge_address_subnet }}"
jump: ACCEPT
when:
- bridge_configure_address | bool
- bridge_authorize_internal_traffic | bool
- when: bridge_mtu is not defined
block:
- name: Determine bridge mtu
shell: |
# Find all interfaces with a permanent mac address type.
# Permanent mac addrs imply "real" hardware and not interfaces we have
# created through this system. This makes our MTU determination mostly
# idempotent allowing us to create multiple overlays without
# perpetually smaller MTUs.
SMALLEST_MTU=""
for X in $(ls /sys/class/net) ; do
MAC_TYPE=$(cat "/sys/class/net/${X}/addr_assign_type")
if [ "$MAC_TYPE" -ne "0" ] ; then
# Type 0 is a permanent address implying a "real"
# interface. We ignore other interfaces as that is what we
# create here
continue
fi
MTU=$(cat "/sys/class/net/${X}/mtu")
if [ -z "$SMALLEST_MTU" ] || [ "$SMALLEST_MTU" -gt "$MTU" ] ; then
SMALLEST_MTU=$MTU
fi
done
# 50 byte overhead for vxlan
echo $(( SMALLEST_MTU - 50 ))
args:
executable: /bin/bash
environment:
PATH: '{{ ansible_env.PATH }}:/bin:/sbin:/usr/sbin'
register: mtu_output
- name: Set bridge_mtu
set_fact:
bridge_mtu: "{{ mtu_output.stdout }}"