michaelrigart / ansible-role-interfaces

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

Bond interface down after all members bounced #88

Closed markgoddard closed 3 years ago

markgoddard commented 3 years ago

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

Steps to reproduce:

playbook.yml:

---
- hosts: localhost
  tasks:
    - import_role:
        name: .
      vars:
        interfaces_bond_interfaces:
          - device: bond0
            bootproto: static
            address: 10.10.0.2
            netmask: 255.255.255.0
            bond_mode: 802.3ad
            bond_slaves: [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 bond member 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 bond interface state] ****************************************************************************************************************************************************
failed: [localhost] (item={u'bond_slaves': [u'fake1', u'fake2'], u'bond_mode': u'802.3ad', u'netmask': u'255.255.255.0', u'bootproto': u'static', u'address': u'10.10.0.2', u'device': u'bond0', u'onboot': True}) => {"changed": false, "item": {"address": "10.10.0.2", "bond_mode": "802.3ad", "bond_slaves": ["fake1", "fake2"], "bootproto": "static", "device": "bond0", "netmask": "255.255.255.0", "onboot": true}, "msg": "Interface bond0 is not active"}