summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthieu Saulnier <fantom@fedoraproject.org>2023-09-05 13:15:15 +0200
committerMatthieu Saulnier <fantom@fedoraproject.org>2023-09-05 13:15:15 +0200
commit7b261d2400aca52fc818d8f2e94fab764bcdcd94 (patch)
tree521d9b1adee2c8164e539ed7e55486b75ccd15df
parent2408093d65c518b0e8afaa5cf3f459df98090cae (diff)
downloadplaybooks-ansible-7b261d2400aca52fc818d8f2e94fab764bcdcd94.tar.gz
playbooks-ansible-7b261d2400aca52fc818d8f2e94fab764bcdcd94.tar.xz
playbooks-ansible-7b261d2400aca52fc818d8f2e94fab764bcdcd94.zip
Add DHCPv6 config
-rw-r--r--roles/common/files/dhclient.service13
-rw-r--r--roles/common/handlers/systemd.yml6
-rw-r--r--roles/common/tasks/dhcpv6.yml20
-rw-r--r--roles/common/tasks/main.yml3
-rw-r--r--roles/common/tasks/pkgs.yml6
-rw-r--r--roles/common/templates/dhclient6.conf.j24
6 files changed, 52 insertions, 0 deletions
diff --git a/roles/common/files/dhclient.service b/roles/common/files/dhclient.service
new file mode 100644
index 0000000..7968d68
--- /dev/null
+++ b/roles/common/files/dhclient.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=dhclient for sending DUID IPv6
+Wants=network.target
+Before=network-online.target
+
+[Service]
+Type=forking
+Restart=on-failure
+RestartSec=10
+ExecStart=/usr/sbin/dhclient -cf /etc/dhcp/dhclient6.conf -6 -P -v eth0
+
+[Install]
+WantedBy=network-pre.target
diff --git a/roles/common/handlers/systemd.yml b/roles/common/handlers/systemd.yml
index ed37f95..3b4454b 100644
--- a/roles/common/handlers/systemd.yml
+++ b/roles/common/handlers/systemd.yml
@@ -6,3 +6,9 @@
service:
name: dnf-makecache.timer
state: restarted
+
+- name: launch dhclient
+ service:
+ name: dhclient.service
+ state: started
+ enabled: yes
diff --git a/roles/common/tasks/dhcpv6.yml b/roles/common/tasks/dhcpv6.yml
new file mode 100644
index 0000000..693af0f
--- /dev/null
+++ b/roles/common/tasks/dhcpv6.yml
@@ -0,0 +1,20 @@
+- name: Configuration du fichier dhcpv6
+ template:
+ src: dhclient6.conf.j2
+ dest: /etc/dhcp/dhclient6.conf
+ owner: root
+ group: root
+ mode: 0644
+ when: duid is defined
+
+- name: Unité systemd pour dhclient6
+ copy:
+ src: dhclient.service
+ dest: /etc/systemd/system/dhclient.service
+ owner: root
+ group: root
+ mode: 0644
+ notify:
+ - reload systemd
+ - launch dhclient
+ when: duid is defined
diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml
index f42e8d5..555ed05 100644
--- a/roles/common/tasks/main.yml
+++ b/roles/common/tasks/main.yml
@@ -37,6 +37,9 @@
- name: Installation des logiciels de base
import_tasks: pkgs.yml
+- name: Configuration DHCPv6 chez Online
+ import_tasks: dhcpv6.yml
+
- name: État des services
import_tasks: services.yml
diff --git a/roles/common/tasks/pkgs.yml b/roles/common/tasks/pkgs.yml
index 84b090f..53b53b7 100644
--- a/roles/common/tasks/pkgs.yml
+++ b/roles/common/tasks/pkgs.yml
@@ -72,3 +72,9 @@
name: pv
state: present
when: ansible_devices.sr0 is defined
+
+- name: Installation de dhcpv6
+ package:
+ name: dhcp-client
+ state: present
+ when: duid is defined
diff --git a/roles/common/templates/dhclient6.conf.j2 b/roles/common/templates/dhclient6.conf.j2
new file mode 100644
index 0000000..922f2c3
--- /dev/null
+++ b/roles/common/templates/dhclient6.conf.j2
@@ -0,0 +1,4 @@
+interface "eth0" {
+ send dhcp6.client-id {{ duid }};
+ request;
+}