2018-10-08 21:13:03 +00:00
|
|
|
- name: Install dhcp package (debuntu)
|
|
|
|
package:
|
|
|
|
name: isc-dhcp-server
|
|
|
|
state: present
|
2020-10-16 20:46:19 +00:00
|
|
|
when: is_debuntu
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2018-10-08 21:13:03 +00:00
|
|
|
- name: Install dhcp package (not debuntu)
|
|
|
|
package:
|
|
|
|
name: dhcp
|
|
|
|
state: present
|
2017-05-27 23:10:45 +00:00
|
|
|
when: not is_debuntu
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2018-10-08 21:13:03 +00:00
|
|
|
- name: Create non-privileged user 'dhcpd' (debuntu)
|
|
|
|
user:
|
|
|
|
name: dhcpd
|
|
|
|
createhome: no
|
2020-10-16 20:46:19 +00:00
|
|
|
when: is_debuntu
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2018-10-08 21:13:03 +00:00
|
|
|
- name: Disable stock dhcp_service (debuntu)
|
|
|
|
service:
|
|
|
|
name: "{{ dhcp_service }}"
|
|
|
|
enabled: no
|
|
|
|
state: stopped
|
2020-10-16 20:46:19 +00:00
|
|
|
when: is_debuntu
|
2017-11-20 02:34:19 +00:00
|
|
|
|
2019-05-24 07:06:43 +00:00
|
|
|
- name: Disable stock dhcp_service ipv6 (ubuntu-18 and higher)
|
2018-10-08 21:13:03 +00:00
|
|
|
service:
|
|
|
|
name: "{{ dhcp_service }}6"
|
|
|
|
enabled: no
|
|
|
|
state: stopped
|
2022-10-28 17:55:43 +00:00
|
|
|
when: is_ubuntu
|
|
|
|
#when: is_ubuntu and not is_ubuntu_16
|
2020-10-16 20:46:19 +00:00
|
|
|
#when: is_ubuntu_18
|
2018-05-03 14:40:08 +00:00
|
|
|
|
2017-11-20 02:34:19 +00:00
|
|
|
- name: Install systemd unit file to /etc/systemd/system/dhcpd.service
|
2018-10-08 21:13:03 +00:00
|
|
|
template:
|
2020-01-12 22:06:24 +00:00
|
|
|
src: roles/network/templates/dhcp/dhcpd.service
|
|
|
|
dest: /etc/systemd/system/dhcpd.service
|
|
|
|
# owner: root
|
|
|
|
# group: root
|
|
|
|
# mode: '0644'
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2018-10-08 21:13:03 +00:00
|
|
|
- name: Create file /var/lib/dhcpd/dhcpd.leases (redhat)
|
2017-05-27 18:09:50 +00:00
|
|
|
command: touch /var/lib/dhcpd/dhcpd.leases
|
2018-10-08 21:44:35 +00:00
|
|
|
args:
|
2018-10-08 21:13:03 +00:00
|
|
|
creates: /var/lib/dhcpd/dhcpd.leases
|
2020-10-16 20:46:19 +00:00
|
|
|
when: is_redhat
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2018-10-08 21:13:03 +00:00
|
|
|
- name: Set dhcpd.leases permissions/ownership (redhat)
|
|
|
|
file:
|
|
|
|
path: /var/lib/dhcpd/dhcpd.leases
|
|
|
|
owner: dhcpd
|
|
|
|
group: dhcpd
|
2020-01-12 22:06:24 +00:00
|
|
|
mode: '0644'
|
|
|
|
# state: file
|
2020-10-16 20:46:19 +00:00
|
|
|
when: is_redhat
|
2019-10-16 14:39:08 +00:00
|
|
|
|
2020-01-12 23:15:33 +00:00
|
|
|
- name: "Add 'dhcpd_installed: True' to {{ iiab_state_file }}"
|
2019-10-16 14:39:08 +00:00
|
|
|
lineinfile:
|
2020-02-04 00:54:04 +00:00
|
|
|
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
2019-10-16 14:39:08 +00:00
|
|
|
regexp: '^dhcpd_installed'
|
|
|
|
line: 'dhcpd_installed: True'
|