Skip to content
Snippets Groups Projects
Commit 36710cc2 authored by nimrod's avatar nimrod
Browse files

- Added config handling.

parent 238fea93
No related branches found
No related tags found
No related merge requests found
......@@ -2,3 +2,4 @@
# defaults file for dhcp
dhcp_mail_alias: root
dhcp_config:
......@@ -7,6 +7,8 @@
- ansible_os_family in dhcp_service
- ansible_os_family in dhcp_user
- ansible_os_family in aliases_file
- ansible_os_family in dhcp_conf_file
- dhcp_config is defined
- name: APT install
apt:
......@@ -25,6 +27,16 @@
notify:
- Update SMTPd database
- name: Copy configuration
copy:
content: '{{ dhcp_config }}'
dest: '{{ dhcp_conf_file[ansible_os_family] }}'
owner: root
group: 0
mode: 0o0644
notify:
- Restart ISC DHCP server
- name: Enable service
service:
name: '{{ dhcp_service[ansible_os_family] }}'
......
......@@ -11,6 +11,7 @@
strategy: free
roles:
- role: dhcp
dhcp_config: "{{ lookup('template', 'dhcpd.conf.j2') }}"
post_tasks: # For testing.
- name: APT install
when: ansible_pkg_mgr == 'apt'
......
......@@ -12,3 +12,7 @@ aliases_file:
dhcp_user:
OpenBSD: _dhcp
Debian: dhcp
dhcp_conf_file:
OpenBSD: /etc/dhcpd.conf
Debian: /etc/dhcp/dhcpd.conf
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment