]> git.somenet.org - root/pub/somesible.git/blob - roles/server/dhcpd/tasks/main.yml
roles/service/mattermost/defaults
[root/pub/somesible.git] / roles / server / dhcpd / tasks / main.yml
1 #####################################
2 ### someone's ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
6 #
7 ---
8 - name: install dhcp-server
9   apt:
10     pkg:
11     - isc-dhcp-server
12     state: present
13     policy_rc_d: 101
14   tags: "online"
15   ignore_errors: "{{ignore_online_errors | bool}}"
16
17
18 - name: set interfaces to serve
19   lineinfile:
20     name: /etc/default/isc-dhcp-server
21     regexp: '^INTERFACESv4='
22     line: 'INTERFACESv4="{{dhcpd_interfaces}}"'
23
24
25 - name: copy dhcpd.conf
26   copy:
27     src: "{{item}}"
28     dest: "/etc/dhcp/dhcpd.conf"
29     mode: 0640
30     owner: "root"
31     group: "root"
32   with_first_found:
33     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/dhcpd.conf"
34     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/dhcpd.conf"
35     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/dhcpd.conf"
36     - "default/dhcpd.conf"
37   notify: restart isc-dhcp-server.service
38
39
40 - name: enable and start isc-dhcp-server.service
41   include_role: name="base/systemd/enable-and-start"
42   vars:
43     service_name: isc-dhcp-server.service