ansible-role-interfaces icon indicating copy to clipboard operation
ansible-role-interfaces copied to clipboard

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

Open Aethylred opened this issue 2 years ago • 2 comments

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 avatar Sep 16 '22 02:09 Aethylred

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 avatar Sep 16 '22 02:09 Aethylred

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.

Aethylred avatar Sep 16 '22 03:09 Aethylred