Add support for ubuntu
Ponieważ niektóre ustawienia na ubuntu były by trudne do wygenerowania, proponuję przerobić API jednocześnie dodając opcje nazywania interfejsów (za wyjątkiem interfejsów fizycznych co sprawia problemy zarówno w centosie jak i na ubuntu)
Jeśli będzie nam zależało, np z uwagi na spójność żeby nazywać interfejsy fizyczne, można to osiągnąć poprzez robienie interfejsu bond dla każdego z nich i ustawienie go w domyślnym trybie balance-rr
Oto moja propozycja nowego API
interfaces
Action Configures network interfaces.
-
networking_interfaces
- list of interfaces configuration to set.-
name
- interface name (forethernet
type name assigned by operating system must be used) -
(optional)
type
- interface type (one ofethernet
,bond
,vlan
), if not specifiedethernet
will be used. -
(optional)
enable_dhcp
- shoudl DHCP be used on interface (default:false
) -
addresses
- list of ip adresses in CIDR format ### NOTATKA, na centosie można zrobić split po znaku/
i wydziciągnąć prefix,ip osobno -
(optional)
gateway
- default route associated with interface.⚠ setting gateway on multiple interfaces will cause single(random) default route to be used, instead of expected ECMP. -
(optional)
mtu
- sets interface Maximum Transmission Unit. (default:1500
) (if increasing remember to adjust underlays accoringly if used) -
(optional)
underlay
- list of names or name of underlay interfaces (required onbond
andvlan
) for vlan use string with name, for bonding list. -
(optional)
vlan_id
- 802.1Q vlan identifier -
(optional)
bonding
- dictionary with bonding options:-
(optional)
mode
- mode of bonding to use (one of:balance-rr
,active-backup
,balance-xor
,broadcast
,802.3ad
,balance-tlb
,balance-alb
) default ("balance-rr"
) -
(optional)
carrer_check_interval
- interval between checking if bond underlay interface has carrer connected. by default cerrer checking is disabled. -
(optional)
lacp_rate
- Set the rate at which LACPDUs are transmitted. This is only useful in 802.3ad mode. Possible values are slow (30 seconds, default), and fast (every second).
-
(optional)
-
możliwe problemy
- na centosie w bondingu interfejsy bondowane wzkazują na interfejs bond, natomiast w ubuntu odwrotnie co może nieco utrudnić generowanie konfiguracji, lub nażucić wymóg powielenia parametru w API czego chciał bym uniknąć
flow
- wczytanie starefo stanu konieczności restart (fakt ansiblowy)
- instalacja NetworkManagera na centosie
- generowanie plików konfiguracyjnych (centos plik na interfejs, ubuntu plik na typ
60-ehternets.yaml
61-bonds.yaml
62-vlans.yaml
63-routes.yaml
) - zapisanie faktu czy wymagany jest restart w
_networking_interface_facts_file: "/etc/ansible/facts.d/networking_interface.fact"
oraz zminnej ansiblowej - jeśli
networking_interfaces_synchronize_immediately
zawołanie akcjiinterfaces_synchronize
- akcja
interfaces_synchronize
- zastosowanie ustawień (netplan apply, lub reset network dla centosa)
- wyzerowanie informacji o konieczności restartu w
_networking_interface_facts_file
Pozostałe akcje
Akcje DNS i routes niewymagają zmiany API, jedynie poprawienia/dodania na sustemie ubuntu-focal
Edited by Piotr Korthals