kpfleming.systemd_networkd.network role – Manages systemd-networkd networks.

Note

This role is part of the kpfleming.systemd_networkd collection (version 25.3.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it use: ansible-galaxy collection install kpfleming.systemd_networkd.

To use it in a playbook, specify: kpfleming.systemd_networkd.network.

Entry point main – Manages systemd-networkd networks.

Synopsis

  • This role operates in one of two modes: 1) When “dropin_for” is not specified, creates a .network file in /etc/systemd/network using the supplied “name”, and applies the configuration provided to that file. 2) When “dropin_for” is specified, creates a .conf file in the dropin directory for the network specified, using the supplied “name”, and applies the configuration provided to that file.

  • Detailed descriptions of parameters and their behavior can be found in ‘man systemd.network’.

  • Sets fact named ‘systemd_networkd_network_changed’ to either true or false to indicate whether any changes were made.

Parameters

Parameter

Comments

dropin_for

string

Name of network to which this configuration should be applied as a dropin.

networks

list / elements=dictionary / required

Attributes of the networks to be managed.

addresses

list / elements=dictionary

Addresses to be used on the network.

address

string

An IPv4 or IPv6 address.

broadcast

string

The broadcast address of the network.

duplicate_address_detection

string

Controls Duplicate Address Detection for this address.

Choices:

  • "both"

  • "ipv4"

  • "ipv6"

  • "none"

home_address

boolean

Whether this network is the system’s home address.

Choices:

  • false

  • true

peer

string

The address of the peer on a point-to-point network.

bind_carrier

list / elements=string

Bind carrier status to other networks.

cake

dictionary

added in kpfleming.systemd_networkd 24.1.0

Attributes of the Common Applications Kept Enhanced (CAKE) queueing discipline (qdisc).

bandwidth

string

added in kpfleming.systemd_networkd 24.1.0

Bandwidth for the shaper, in bits-per-second. Suffixes K, M, and G can be used.

compensation_mode

string

added in kpfleming.systemd_networkd 24.1.0

Compensate for ATM or PTM framing and bit encoding.

Choices:

  • "none"

  • "atm"

  • "ptm"

flow_isolation_mode

string

added in kpfleming.systemd_networkd 24.1.0

Method use for providing fairness between queues in the shaper.

Choices:

  • "none"

  • "src-host"

  • "dst-host"

  • "hosts"

  • "flows"

  • "dual-src-host"

  • "dual-dst-host"

  • "triple"

mpu_bytes

string

added in kpfleming.systemd_networkd 24.1.0

Round the net packet size (after overhead bytes have been added) to a minimum of this value.

nat

boolean

added in kpfleming.systemd_networkd 24.1.0

Perform NAT lookups to obtain true source host addresses before constructing flows.

Choices:

  • false

  • true

overhead_bytes

string

added in kpfleming.systemd_networkd 24.1.0

Number of bytes to be added to the raw data size of each packet.

priority_queueing_preset

string

added in kpfleming.systemd_networkd 24.1.0

Construct tins (of flow-isolation queues) using the selected mechanism.

Choices:

  • "besteffort"

  • "precedence"

  • "diffserv8"

  • "diffserv4"

  • "diffserv3"

split_gso

boolean

added in kpfleming.systemd_networkd 24.1.0

Split General Segmentation Offload (GSO) super-packets into their on-the-wire components and dequeue them individually.

Choices:

  • false

  • true

wash

boolean

added in kpfleming.systemd_networkd 24.1.0

Clear DSCP fields, except ECN bits, of packets which pass through the shaper.

Choices:

  • false

  • true

configure_without_carrier

boolean

Allow network configuration without carrier.

Choices:

  • false

  • true

dhcp

string

Configure DHCP clients on the network.

Choices:

  • "ipv4"

  • "ipv6"

  • "True"

  • "False"

dhcpv4

dictionary

Attributes of the DHCPv4 client on the network.

client_identifier

string

Method used to construct the Client Identifier.

Choices:

  • "mac"

  • "duid"

  • "duid-only"

hostname

string

Hostname to be sent.

routes_to_dns

boolean

Whether routes to the provided DNS server(s) should be added to the routing table.

Choices:

  • false

  • true

routes_to_ntp

boolean

Whether routes to the provided NTP server(s) should be added to the routing table.

Choices:

  • false

  • true

send_hostname

boolean

Whether local hostname should be sent to the DHCP server.

Choices:

  • false

  • true

send_release

boolean

Whether an assigned address should be released when the network is stopped.

Choices:

  • false

  • true

use_dns

boolean

Whether DNS server(s) provided by the DHCP server should be used.

Choices:

  • false

  • true

use_gateway

boolean

Whether the default route provided by the DHCP server should be added to the routing table.

Choices:

  • false

  • true

use_hostname

boolean

Whether the hostname provided by the DHCP server should be used.

Choices:

  • false

  • true

use_ntp

boolean

Whether NTP server(s) provided by the DHCP server should be used.

Choices:

  • false

  • true

use_routes

boolean

Whether routes provided by the DHCP server should be added to the routing table.

Choices:

  • false

  • true

dhcpv6

dictionary

Attributes of the DHCPv6 client on the network.

use_dns

boolean

Whether DNS server(s) provided by the DHCP server should be used.

Choices:

  • false

  • true

use_hostname

boolean

Whether the hostname provided by the DHCP server should be used.

Choices:

  • false

  • true

use_ntp

boolean

Whether NTP server(s) provided by the DHCP server should be used.

Choices:

  • false

  • true

without_ra

string

Whether the client should be started even if an RA does not indicate it is needed.

Choices:

  • "False"

  • "solicit"

  • "information-request"

dns

list / elements=string

Configure DNS servers on the network.

emit_lldp

string

Configure LLDP emission on the network.

Choices:

  • "nearest-bridge"

  • "True"

  • "False"

ip_forward

string

Configure IP forwarding (system-wide).

Choices:

  • "ipv4"

  • "ipv6"

  • "True"

  • "False"

ipv4_forwarding

boolean

Enable forwarding of packets that arrive on this network.

Choices:

  • false

  • true

ipv6_accept_ra

boolean

Whether Router Advertisements should be accepted on the network.

Choices:

  • false

  • true

ipv6_duplicate_address_detection

integer

The number of IPv6 DAD probes to send for a new address.

ipv6_forwarding

boolean

Act as a host (false) or router (true).

Choices:

  • false

  • true

ipv6_proxy_ndp

boolean

Configure Proxy NDP support on the network.

Choices:

  • false

  • true

ipv6_proxy_ndp_address

list / elements=string

Configure Proxy NDP addresses on the network.

ipv6acceptra

dictionary

Attributes of the IPv6 RA client on the network.

token

string

Mode, and pattern, used to generate a SLAAC address.

use_dns

boolean

Whether DNS server(s) provided by the RA should be used.

Choices:

  • false

  • true

use_gateway

boolean

Whether the default route provided by the RA should be added to the routing table.

Choices:

  • false

  • true

use_mtu

boolean

Whether the MTU provided by the RA should be used.

Choices:

  • false

  • true

keep_configuration

string

Manage configuration when network is stopped.

Choices:

  • "static"

  • "dynamic"

  • "dynamic-on-stop"

  • "True"

  • "False"

dictionary

Attributes of the link used by the network.

string

How the network should or should not be activated.

Choices:

  • "up"

  • "always-up"

  • "manual"

  • "down"

  • "always-down"

string

The MAC address to be used for the network.

string

The MTU for the network.

string

Which address family(ies) are considered when determining ‘online’ status.

Choices:

  • "any"

  • "both"

  • "ipv4"

  • "ipv6"

string

Whether the network is included in the ‘online’ status determination.

Choices:

  • "True"

  • "False"

  • "missing"

  • "no-carrier"

  • "dormant"

  • "degraded-carrier"

  • "carrier"

  • "enslaved"

  • "routable"

string

Configure link-local addressing on the network.

Choices:

  • "ipv4"

  • "ipv6"

  • "True"

  • "False"

lldp

string

Configure LLDP reception on the network.

Choices:

  • "routers-only"

  • "True"

  • "False"

match

dictionary

Matching attributes of the network.

device

dictionary

Device-specific attributes to be matched.

driver

list / elements=string

Match udev ID_NET_DRIVER.

kind

list / elements=string

Match netlink IFLA_INFO_KIND.

mac_address

list / elements=string

Match current MAC address.

name

list / elements=string

Match udev INTERFACE.

path

list / elements=string

Match udev ID_PATH.

permanent_mac_address

list / elements=string

Match permanent MAC address.

property

list / elements=string

Match udev property.

type

list / elements=string

Match udev DEVTYPE.

system

dictionary

System-specific attributes to be matched.

architecture

string

Match system architecture.

credential

string

Match service credential.

firmware

string

Match system firmware.

host

string

Match hostname or machine ID.

kernel_command_line

string

Match kernel command line option presence.

kernel_version

string

Match kernel version expression.

virtualization

string

Match virtualization type.

name

string / required

Name of the network.

ntp

list / elements=string

Configure NTP servers on the network.

routes

list / elements=dictionary

Routes to be used by the network.

destination

string

IPv4 or IPv6 subnet which can be reached through gateway.

gateway

string

IPv4 or IPv6 address of next-hop router.

metric

string

The route metric.

mtu_bytes

string

The MTU to be applied to this route.

preferred_source

string

IPv4 or IPv6 address to be preferred when sending packets via this route.

scope

string

Scope of the route (IPv4 only).

Choices:

  • "global"

  • "site"

  • "link"

  • "host"

  • "nowhere"

source

string

IPv4 or IPv6 subnet matched against source addresses for selection of this route.

table

string

The routing table to add this route to.

type

string

Type of route.

Choices:

  • "unicast"

  • "local"

  • "broadcast"

  • "anycast"

  • "multicast"

  • "blackhole"

  • "unreachable"

  • "prohibit"

  • "throw"

  • "nat"

  • "xresolve"

routing_policy_rules

list / elements=dictionary

Rules for policy-based routing.

firewall_mark

string

Netfilter firewall mark to match.

from

string

Source address prefix to match.

priority

integer

Priority of this rule.

table

string

Routing table to look up in case of match.

to

string

Destination address prefix to match.

suppress_reload

boolean

Suppress the reloading of systemd-networkd if changes are made.

Choices:

  • false ← (default)

  • true

systemd_root

string

Root path of filesystem containing systemd-networkd configuration files.

Default: ""