An Ansible role that configures systemd-networkd.
For a detailed description see man 5 systemd.network
.
Note: This role doesn't aim to be 100% complete at all times. When new variables are introduced and you need them feel free to contribute.
---
# host_vars/my-client/vars.yml
systemd_networkd_networks:
- name: 20-wired-static
match:
name: en*
network:
address: a.b.c.d/24
gateway: a.b.c.x
dns:
- a.b.c.y
- a.b.c.z
domains:
- example.com
llmnr: 'no'
multicast_dns: 'no'
ntp:
- 1.ntp.example.com
- 2.ntp.example.com
- 3.ntp.example.com
- 4.ntp.example.com
- name: 50-wireless
match:
name: w*
network:
dhcp: ipv4
link_local_addressing: ipv4
dhcp:
route_metric: 20
...
---
# requirements.yml
collections:
- name: idiv_biodiversity.systemd
version: X.Y.Z
...
Write a top-level playbook:
---
- name: head server
hosts: head
roles:
- role: idiv_biodiversity.systemd.systemd_networkd
tags:
- systemd
- systemd-networkd
...
Define the role dependency in meta/main.yml
:
---
dependencies:
- role: idiv_biodiversity.systemd.systemd_networkd
tags:
- systemd
- systemd-networkd
...