michaelrigart / ansible-role-interfaces

An ansible role for configuring different network interfaces
GNU General Public License v3.0
83 stars 61 forks source link

Bridge interface down after all ports bounced (CentOS/RHEL 8) #90

Closed markgoddard closed 3 years ago

markgoddard commented 3 years ago

On CentOS/RHEL 8 systems, if all ports of a bridge go down, the bridge interface will also go down. If the ports are brought back up again, the bridge interface does not automatically come back up. Therefore, if there is some change to the configuration of all of the bridge ports, the bridge may be left in an inactive state.

Steps to reproduce:

playbook.yml:

---
- hosts: localhost
  tasks:
    - import_role:
        name: .
      vars:
        interfaces_bridge_interfaces:
          - device: br0
            bootproto: static
            address: 10.10.0.2
            netmask: 255.255.255.0
            bond_mode: 802.3ad
            ports: [fake1, fake2]
            onboot: yes

Create fake interfaces:

sudo ip link add fake1 type dummy
sudo ip link add fake2 type dummy

Run the playbook:

ansible-playbook playbook.yml

Trigger a restart of both of the bridge port interfaces:

sudo rm /etc/sysconfig/network-scripts/ifcfg-fake1
sudo rm /etc/sysconfig/network-scripts/ifcfg-fake2

Run the playbook again:

ansible-playbook playbook.yml

It fails:

RUNNING HANDLER [. : Check active bridge interface state] **************************************************************************************************************************************************
failed: [localhost] (item={'device': 'br0', 'bootproto': 'static', 'address': '10.10.0.2', 'netmask': '255.255.255.0', 'onboot': True, 'ports': ['fake1', 'fake2']}) => {"changed": false, "item": {"address": "10.10.0.2", "bootproto": "static", "device": "br0", "netmask": "255.255.255.0", "onboot": true, "ports": ["fake1", "fake2"]}, "msg": "Interface br0 is not active"}