This commit is contained in:
parent
5983b4cf01
commit
d3697463ee
@ -32,4 +32,4 @@ dhcpd_zones: []
|
|||||||
# key: dyndns
|
# key: dyndns
|
||||||
# - name: 181.168.192.in-addr.arpa
|
# - name: 181.168.192.in-addr.arpa
|
||||||
# primary: 192.168.181.1
|
# primary: 192.168.181.1
|
||||||
# key: dyndns
|
# key: dyndns
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: restart dhcpd
|
- name: restart dhcpd
|
||||||
systemd:
|
ansible.builtin.systemd:
|
||||||
name: "{{ dhcpd_service_name }}"
|
name: "{{ dhcpd_service_name }}"
|
||||||
state: restarted
|
state: restarted
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: check if at least one subnet is defined
|
- name: check if at least one subnet is defined
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- dhcpd_subnets | length > 0
|
- dhcpd_subnets | length > 0
|
||||||
fail_msg: "No subnet defined"
|
fail_msg: "No subnet defined"
|
||||||
@ -10,14 +10,14 @@
|
|||||||
include_vars: "{{ ansible_os_family }}.yml"
|
include_vars: "{{ ansible_os_family }}.yml"
|
||||||
|
|
||||||
- name: install dhcpd with dependencies
|
- name: install dhcpd with dependencies
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ dhcpd_package_names }}"
|
- "{{ dhcpd_package_names }}"
|
||||||
|
|
||||||
- name: create dhcpd config
|
- name: create dhcpd config
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "dhcpd.conf.j2"
|
src: "dhcpd.conf.j2"
|
||||||
dest: "{{ dhcpd_main_config }}"
|
dest: "{{ dhcpd_main_config }}"
|
||||||
owner: "{{ dhcpd_unix_user }}"
|
owner: "{{ dhcpd_unix_user }}"
|
||||||
@ -31,19 +31,19 @@
|
|||||||
path: "{{ dhcpd_cache_directory }}"
|
path: "{{ dhcpd_cache_directory }}"
|
||||||
register: cache_stats
|
register: cache_stats
|
||||||
- name: remove cache dir
|
- name: remove cache dir
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ dhcpd_cache_directory }}"
|
path: "{{ dhcpd_cache_directory }}"
|
||||||
state: absent
|
state: absent
|
||||||
when: cache_stats.stat.exists
|
when: cache_stats.stat.exists
|
||||||
- name: create cache dir
|
- name: create cache dir
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ dhcpd_cache_directory }}"
|
path: "{{ dhcpd_cache_directory }}"
|
||||||
owner: "{{ dhcpd_unix_user }}"
|
owner: "{{ dhcpd_unix_user }}"
|
||||||
group: "{{ dhcpd_unix_group }}"
|
group: "{{ dhcpd_unix_group }}"
|
||||||
mode: 0755
|
mode: 0755
|
||||||
state: directory
|
state: directory
|
||||||
- name: create cache files
|
- name: create cache files
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ dhcpd_cache_directory }}/{{ item }}"
|
path: "{{ dhcpd_cache_directory }}/{{ item }}"
|
||||||
owner: "{{ dhcpd_unix_user }}"
|
owner: "{{ dhcpd_unix_user }}"
|
||||||
group: "{{ dhcpd_unix_group }}"
|
group: "{{ dhcpd_unix_group }}"
|
||||||
@ -54,9 +54,9 @@
|
|||||||
notify: restart dhcpd
|
notify: restart dhcpd
|
||||||
|
|
||||||
- name: start and enable dhcpd
|
- name: start and enable dhcpd
|
||||||
systemd:
|
ansible.builtin.systemd:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: started
|
state: started
|
||||||
enabled: yes
|
enabled: true
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ dhcpd_service_name }}"
|
- "{{ dhcpd_service_name }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user