collection_opnsense icon indicating copy to clipboard operation
collection_opnsense copied to clipboard

Feature: Add Support for LAGG Interfaces

Open jiuka opened this issue 1 year ago • 2 comments

Link to API

https://docs.opnsense.org/development/api/core/interfaces.html#id3

Description

It would be nice to setup/manage the LAGG Interfaces with Ansible

jiuka avatar Aug 14 '24 12:08 jiuka

Its the first time I try to implement a Module with the collection_opnsense Framework. It works for me currently but I am not so sure if the approach with match_fields is the correct one.

jiuka avatar Aug 14 '24 12:08 jiuka

Greetings!

@jiuka Thank you for this very clean PR!

  1. You are right - the match_fields do not make sense in that case.

The match_fields are used to match the configured entry with any one that exists on the firewall. So in practice this value should never change as you could think of it as the ID of the entry.

Fields like members, primary_member or proto are not static. They could change. We would only fall-back to using those if we have no other option. But in this case we CAN use description or device as unique ID field. Most modules of this collection only use the description field if it is available.

As an example:

You can see - if only one ID-field is used, we do not set the match_fields but the FIELD_ID (as there is no user-choice).

In this case you would need to set the description to be a required module argument.

  1. Some issue with the module arguments:
  • Please add the flowid alias to the use_flowid argument
  • Please add the fast_timeout alias to the lacp_fast_timeout argument
  • Please add the parent alias to the members argument - as that is the name in the WebUI
  • Please add the hash and hash_layers aliases to the lagghash argument
  • As I see it - the default value of lagghash should be unset/empty as that is the default in the WebUI
  • The option default of the argument lacp_strict and use_flowid should not be an option as the option in the WebUI just sets the value to None/empty-string

ansibleguy avatar Aug 15 '24 20:08 ansibleguy