From 8579b99b2ee239b122b58eab9c715a6a55b79ab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoha=C3=AF-Eliel=20BERREBY?= Date: Mon, 6 Apr 2020 19:03:10 +0200 Subject: [PATCH] dhcp: cron.d entry + let main.py restart the server --- roles/isc-dhcp-server/tasks/main.yml | 19 +++++++++++++------ .../templates/cron.d/re2o-services | 4 ++++ 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 roles/isc-dhcp-server/templates/cron.d/re2o-services diff --git a/roles/isc-dhcp-server/tasks/main.yml b/roles/isc-dhcp-server/tasks/main.yml index 2916941..4d6ef54 100644 --- a/roles/isc-dhcp-server/tasks/main.yml +++ b/roles/isc-dhcp-server/tasks/main.yml @@ -27,6 +27,19 @@ dest: /etc/logrotate.d/dhcp mode: 0644 +- name: set up cron to reload dhcp re2o service + cron: + # Do not change this name or idempotence *might* be lost. + name: dhcp-re2o-service + cron_file: re2o-services + minute: "*" + hour: "*" + day: "*" + weekday: "*" + month: "*" + user: root + job: "/usr/bin/python3 /var/local/re2o-services/dhcp/main.py" + - name: restart rsyslog systemd: name: rsyslog @@ -50,9 +63,3 @@ src: dhcp/dhcpd.conf.j2 dest: /etc/dhcp/dhcpd.conf mode: 0600 - -- name: Ensure that isc-dhcp-server is started / reloaded - systemd: - name: isc-dhcp-server - state: restarted - enabled: true diff --git a/roles/isc-dhcp-server/templates/cron.d/re2o-services b/roles/isc-dhcp-server/templates/cron.d/re2o-services new file mode 100644 index 0000000..abc05dd --- /dev/null +++ b/roles/isc-dhcp-server/templates/cron.d/re2o-services @@ -0,0 +1,4 @@ +# Régénération des services re2o + +# Régénération du dhcp +* * * * * root /usr/bin/python3 /var/local/re2o-services/dhcp/main.py