The networking module for Debian-family distributions that use netplan (Ubuntu 18.04+, and Debian systems where netplan is the active renderer).
This is the ip execution-module provider behind network.managed on netplan systems. The legacy
debian_ip provider writes
/etc/network/interfaces (ifupdown), which netplan ignores -- see
issue #62219. This provider instead generates per-interface netplan YAML under
/etc/netplan/ and applies it with netplan.
New in version 3006.28.
Note
netplan is the source of truth here, so only the subset of the
network.managed schema that maps cleanly onto netplan v2 is supported
(addresses, gateway, nameservers, mtu, dhcp4/dhcp6). ifupdown-only options
such as ethtool offload settings and up/down hook scripts have no netplan
equivalent and raise an informative error rather than being silently
dropped.
Apply the generated netplan configuration with netplan apply.
CLI Example:
salt '*' ip.apply_network_settings
Build (and, unless test=True, write) the netplan configuration for a
network interface. Returns the rendered YAML as a list of lines.
CLI Example:
salt '*' ip.build_interface eth0 eth True ipaddr=10.0.0.5 netmask=255.255.255.0
No-op on netplan: there is no global /etc/network equivalent; settings
are expressed per interface. Returns an empty list.
CLI Example:
salt '*' ip.build_network_settings
Build the netplan routes for iface. On netplan, routes live inside the
interface definition, so this folds the provided routes into the
salt-managed interface document. Returns the rendered routes as lines.
CLI Example:
salt '*' ip.build_routes eth0 routes='[{"name": "n", "ipaddr": "10.1.0.0", "netmask": "255.255.0.0", "gateway": "10.0.0.1"}]'
Bring iface down with ip link set <iface> down.
CLI Example:
salt '*' ip.down eth0
Return the salt-managed netplan configuration for iface as a list of
lines, or an empty list if salt does not manage it yet.
CLI Example:
salt '*' ip.get_interface eth0
netplan has no separate global network-settings file (the per-interface YAML carries everything). Returns an empty list.
CLI Example:
salt '*' ip.get_network_settings
Return the routes currently declared for iface in the salt-managed
netplan file, as a list of lines.
CLI Example:
salt '*' ip.get_routes eth0
Return True if netplan appears to be the active network renderer: the
netplan command is available and /etc/netplan exists.
CLI Example:
salt '*' ip.netplan_active
Apply the netplan configuration (which brings managed interfaces up).
CLI Example:
salt '*' ip.up eth0
Docs for previous releases are available on readthedocs.org.
Latest Salt release: 3007.15