2019-05-04 10:54:51 +02:00
|
|
|
---
|
|
|
|
- name: Install isc-dhcp-server
|
|
|
|
apt:
|
|
|
|
update_cache: true
|
|
|
|
name: isc-dhcp-server
|
|
|
|
state: present
|
|
|
|
register: apt_result
|
|
|
|
retries: 3
|
|
|
|
until: apt_result is succeeded
|
2020-05-08 16:44:08 +02:00
|
|
|
notify: restart dhcpd
|
2019-05-04 10:54:51 +02:00
|
|
|
|
2020-04-06 17:42:54 +02:00
|
|
|
- name: Ensure dhcp log directory exists
|
|
|
|
file:
|
|
|
|
path: /var/log/dhcp
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rwx,g=rx,a=rx
|
|
|
|
state: directory
|
|
|
|
|
2020-04-06 17:58:02 +02:00
|
|
|
- name: Ensure rsyslog knows where to send dhcp logs
|
2020-04-06 17:42:54 +02:00
|
|
|
lineinfile:
|
|
|
|
path: /etc/rsyslog.conf
|
2020-04-06 17:58:02 +02:00
|
|
|
line: "local7.* /var/log/dhcp/dhcpd.log"
|
|
|
|
|
|
|
|
- name: Configure dhcp log rotation
|
|
|
|
template:
|
|
|
|
src: logrotate.d/dhcp.j2
|
|
|
|
dest: /etc/logrotate.d/dhcp
|
|
|
|
mode: 0644
|
|
|
|
|
2020-04-06 19:03:10 +02:00
|
|
|
- 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"
|
|
|
|
|
2020-04-06 17:58:02 +02:00
|
|
|
- name: restart rsyslog
|
|
|
|
systemd:
|
|
|
|
name: rsyslog
|
|
|
|
state: restarted
|
2020-04-06 16:54:20 +02:00
|
|
|
|
|
|
|
- name: Configure /etc/default/isc-dhcp-server
|
|
|
|
template:
|
|
|
|
src: default/isc-dhcp-server.j2
|
|
|
|
dest: /etc/default/isc-dhcp-server
|
|
|
|
mode: 0644
|
2020-05-08 16:44:08 +02:00
|
|
|
notify: restart dhcpd
|
2020-04-06 16:54:20 +02:00
|
|
|
|
2020-04-06 17:28:04 +02:00
|
|
|
- name: Configure dhcp-failover.conf
|
|
|
|
template:
|
|
|
|
src: dhcp/dhcp-failover.conf.j2
|
|
|
|
dest: /etc/dhcp/dhcp-failover.conf
|
|
|
|
mode: 0600
|
|
|
|
when: dhcp_failover is defined
|
2020-05-08 16:44:08 +02:00
|
|
|
notify: restart dhcpd
|
2020-04-06 17:28:04 +02:00
|
|
|
|
|
|
|
- name: Configure dhcpd.conf
|
2019-05-04 10:54:51 +02:00
|
|
|
template:
|
|
|
|
src: dhcp/dhcpd.conf.j2
|
|
|
|
dest: /etc/dhcp/dhcpd.conf
|
|
|
|
mode: 0600
|
2020-05-08 16:44:08 +02:00
|
|
|
notify: restart dhcpd
|