WIP: Infrastructure routers #91

Draft
jeltz wants to merge 15 commits from infra_router into master
4 changed files with 74 additions and 0 deletions
Showing only changes of commit 9c0bf190e2 - Show all commits

View file

@ -0,0 +1,20 @@
---
- name: Update initramfs
command:
cmd: update-initramfs -u
- name: Restart systemd-networkd
systemd:
name: systemd-networkd.service
state: restarted
- name: Reboot required
file:
path: /var/run/reboot-required
state: touch
modification_time: preserve
access_time: preserve
owner: root
group: root
mode: u=rw,g=r,o=r
...

View file

@ -0,0 +1,30 @@
---
- name: Configure interfaces links
template:
src: link.j2
dest: "/etc/systemd/network/10-{{ item.key }}.link"
owner: root
group: systemd-network
mode: u=rw,g=r,o=
loop: "{{ networkd_interfaces | dict2items }}"
notify:
- Update initramfs
- Reboot required
- name: Configure interfaces networks
template:
src: network.j2
dest: "/etc/systemd/network/10-{{ item.key }}.network"
owner: root
group: systemd-network
mode: u=rw,g=r,o=
loop: "{{ networkd_interfaces | dict2items }}"
notify:
- Restart systemd-networkd
- name: Enable and start systemd-networkd
systemd:
name: systemd-networkd.service
enabled: true
state: started
...

View file

@ -0,0 +1,7 @@
{{ ansible_managed | comment }}
[Match]
MACAddress={{ item.value.mac_addr }}
[Link]
Name={{ item.key }}

View file

@ -0,0 +1,17 @@
{{ ansible_managed | comment }}
[Match]
Name={{ item.key }}
{% if not (item.value.link_local | default(true)) %}
[Network]
LinkLocalAddressing=no
{% endif %}
{% for addr in item.value.ip_addrs | default([]) %}
[Address]
Address={{ addr }}
{% endfor %}
[FairQueueingControlledDelay]
Parent=root