Net
Role to set custom network configuration with NetworkManager (jammy_desktop) and netplan (rest)
General
This role consists of three main steps:
- Checks whether the host is jammy_desktop
- if yes then it will set a default network config (NetworkManager) that looks the following:
# This is the network config written by 'subiquity'
{{ donottouch_header }}
network:
version: 2
renderer: NetworkManager
ethernets:
{{ ansible_default_ipv4.interface }}:
critical: true
dhcp-identifier: mac
dhcp4: true
dhcp6: true
nameservers:
addresses:
- 129.132.98.12
- 129.132.250.2
search:
- d.ethz.ch.
- ethz.ch.
- Checks If in the host entry of the target, the net_netplan_yml_conf variable has been defined with a valid netplan configuration:
net_netplan_yml_conf:
network:
renderer: NetworkManager
version: 2
ethernets:
enp1s0:
critical: true
dhcp-identifier: mac
dhcp4: true
dhcp6: true
nameservers:
addresses:
- 129.132.98.12
- 129.132.250.2
search:
- d.ethz.ch.
- ethz.ch.
- then it will fill up a file called 11-s4d-conf.j2 and
- copy it to /etc/netplan
-
after copying it will apply this network configuration
-
Checks if userconfig-template already exists
- if yes then it will do nothing
- if no then it will copy a file called 50-your-own-network-config.yaml
- This files content is commented out by default
- after copying it will apply this network configuration
Dependencies
Role Dependencies
Package Dependencies
Role Variables
Name | Type | Default value | Purpose | Comment | Role |
---|---|---|---|---|---|
net_netplan_yml_conf | String | undefined, by default the Ubuntu default network config is used. That means, if the var net_netplan_yml_conf is not defined, ansible skips the deployment & installation of netplan and its config. If the variable is defined empty, ansible aborts with an error. | used to push custom network config on hosts/inventory level see example of usage in hosts/inventory file above | - | jammy_net |
net_conf | Boolean | false | defines whether net role is used or not. Has to be set to true in hosts/inventory file | - | jammy_net |
gnome_conf | Boolean | false | defines, if gnome and so NetworkManager should be installed and used as renderer for netplan('s) | - | jammy_net |
support_contact | String | "" | can be defined in hosts/inventory file. Defines the support contact address in the own network config file | - | multirole |
Configuration Examples
Network Configuration with two bridges:
net_netplan_yml_conf:
network:
version: 2
renderer: networkd
ethernets:
eno1:
dhcp4: no
eno2:
dhcp4: no
bridges:
br719:
interfaces: [eno1]
dhcp4: yes
dhcp4-overrides:
route-metric: 50
macaddress: AA:AA:AA:AA:AA:AA
br136:
interfaces: [eno2]
dhcp4: yes
dhcp4-overrides:
route-metric: 200
macaddress: BB:BB:BB:BB:BB:BB
Example Playbook
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
BSD
Author Information
Maintainer: Niels Dill
Support-Contact: s4d-linux-support@id.ethz.ch