michaelrigart / ansible-role-interfaces

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

When creating a bonded InfiniBand re-running the role gives 'Interface ib0 is of an unexpected type' #134

Open Aethylred opened 2 years ago

Aethylred commented 2 years ago

The interface type for a bonded Infinband interface should either not be defined, ot be InfiniBand, but not ether as per

https://github.com/michaelrigart/ansible-role-interfaces/blob/master/filter_plugins/filters.py#L234

The variables I'm using for this are:

interfaces_bond_interfaces:
  - device: "ib-bond0"
    bootproto: static
    address: "{{ ib_ip }}"
    netmask: "{{ ib_netmask }}"
    type: ipoib
    bond_mode: active-backup
    bond_slaves:
      - ib0
      - ib1

I'm expectin the type: ipoib to do "the right thing"

Error output:

RUNNING HANDLER [michaelrigart.interfaces : Check active bond interface state] *********************************************************************************************************************************************************************
task path: /home/test/ib_playbooks/ignore/roles/michaelrigart.interfaces/handlers/main.yml:182
failed: [test01] (item={'device': 'ib-bond0', 'bootproto': 'static', 'address': '10.0.0.1', 'netmask': '255.255.252.0', 'type': 'ipoib', 'bond_mode': 'active-backup', 'bond_slaves': ['ib0', 'ib1']}) => changed=false 
  ansible_loop_var: item
  item:
    address: 10.0.0.1
    bond_mode: active-backup
    bond_slaves:
    - ib0
    - ib1
    bootproto: static
    device: ib-bond0
    netmask: 255.255.252.0
    type: ipoib
  msg: Interface ib0 is of an unexpected type
Aethylred commented 2 years ago

The bonded IB interface works as configured by the first run works BTW, it's the second run that fails. It's either because the expected type is forced in https://github.com/michaelrigart/ansible-role-interfaces/blob/master/filter_plugins/filters.py#L234

ot it's because a type is never set by the bond slave interface template: https://github.com/michaelrigart/ansible-role-interfaces/blob/master/templates/bond_slave_RedHat.j2

Aethylred commented 2 years ago

Changing the line https://github.com/michaelrigart/ansible-role-interfaces/blob/master/filter_plugins/filters.py#L234 to

        result = _interface_check(context, slave_interface)

Resolves the issue, but I'm not sure if it's the correct thing to do.