Ansible Role linuxfabrik.lfops.network¶
This role is a thin wrapper around the fedora.linux_system_roles.network role, the upstream Linux System Role for declaring network connections (ethernet, bonds, bridges, VLANs, IP / DNS / route configuration, ...) on top of NetworkManager. It additionally cleans up Hetzner-specific cruft that conflicts with NetworkManager.
Concretely, this role:
- Calls
fedora.linux_system_roles.networkwith whatevernetwork_connectionsornetwork_stateyou pass in (host or group vars). With neither set, the upstream role is not called at all, so it neither installs nor starts NetworkManager. - On Red Hat-family hosts only: removes the
hc-utilspackage (Hetzner Cloud utilities). They install legacy ifcfg scripts that fight with NetworkManager. The task tolerates the package not being installed (ignore_errors: true). - Prints a reminder that NetworkManager may need to be restarted by hand (
systemctl restart NetworkManager) whenever the upstream role changed a connection profile. The upstream role applies connections via NetworkManager APIs, but a few changes (e.g. plugin reloads) require a service restart. The reminder is repeated in the block of manual steps that every LFOps playbook prints above thePLAY RECAP.
Available since LFOps 2.0.0.
Known Limitations¶
- Teaming (
type: 'team') is not available on RHEL 10 and later. The upstream role aborts the run with a message pointing at bonding, so a host that carried a team connection on RHEL 9 has to be converted totype: 'bond'before it is upgraded.
Requirements¶
Manual steps:
- Install the Linux System Roles on the Ansible control node, e.g. via
ansible-galaxy collection install fedora.linux_system_roles.
Tags¶
network
- Configures the network and removes
hc-utils(Hetzner) on Red Hat hosts. - Triggers: none.
Optional Role Variables¶
This role does not define its own variables. All configuration is passed straight through to fedora.linux_system_roles.network. See the upstream README for the full list (network_connections, network_provider, network_state, ...).
Example:
network_connections:
- name: 'eth0'
type: 'ethernet'
autoconnect: true
ip:
address:
- '192.0.2.26/32'
dhcp4: false
ipv6_disabled: true
gateway4: '192.0.2.1'
auto_gateway: true
dns:
- '1.1.1.1'
dns_search:
- 'example.com'
state: 'up'
# remove the default connections
# check with `nmcli connection show`
- name: 'cloud-init eth0'
persistent_state: 'absent'
- name: 'System eth0'
persistent_state: 'absent'
- name: 'System eth1'
persistent_state: 'absent'