ansible-ffibk/roles/service-dhcpd/tasks/main.yml

67 lines
1.4 KiB
YAML
Raw Permalink Normal View History

---
- name: install dhcp packages
package:
name: "{{ kea_packages }}"
state: present
- name: create systemd override dir for kea-dhcp4-server.service
file:
path: /etc/systemd/system/kea-dhcp4-server.service.d
state: directory
owner: root
group: root
mode: 0755
- name: configure systemd unit overrides
template:
src: kea_dhcp4_server_service_overrides.j2
dest: /etc/systemd/system/kea-dhcp4-server.service.d/override.conf
owner: root
group: root
mode: 0644
notify:
- reload systemd
- restart kea-dhcp4-server
- name: configure kea dhcp server
template:
src: kea_dhcp4.conf.j2
dest: /etc/kea/kea-dhcp4.conf
notify: restart kea-dhcp4-server
- name: remove kea init file if present
file:
path: /etc/init.d/kea-dhcp4-server
state: absent
notify: reload systemd
2017-10-26 22:35:55 +02:00
2019-05-31 13:45:16 +02:00
- name: install kea-exporter
pip:
name: kea-exporter
executable: pip3
notify: restart kea-exporter
- name: create systemd unit for exporter
template:
src: "kea-exporter.service.j2"
dest: "/etc/systemd/system/kea-exporter.service"
notify: reload systemd
- name: write vhost for exporter
template:
src: kea_exporter_vhost.conf.j2
dest: /etc/nginx/conf.d/kea_exporter.conf
owner: root
group: root
mode: 0644
notify: restart nginx
- name: enable systemd units
2017-10-26 22:35:55 +02:00
systemd:
2019-05-31 13:45:16 +02:00
name: "{{ item }}"
2017-10-26 22:35:55 +02:00
enabled: yes
state: started
2019-05-31 13:45:16 +02:00
loop:
- kea-dhcp4-server
- kea-exporter