blob: c33ddc489909e00b11955b1b071c295db0cf9190 [file] [log] [blame]
Zack Williams9fc21d72020-11-22 22:36:54 -07001---
2# dhcpd tasks/main.yml
3#
4# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
5# SPDX-License-Identifier: Apache-2.0
6
7- name: include OS-specific vars
Zack Williams5101b5f2022-05-17 13:30:01 -07008 include_vars: "{{ item }}"
9 with_first_found:
10 - "{{ ansible_distribution }}_{{ ansible_distribution_version }}.yml"
11 - "{{ ansible_distribution }}.yml"
12 - "{{ ansible_os_family }}.yml"
Zack Williams9fc21d72020-11-22 22:36:54 -070013
14- name: include OS-specific tasks
15 include_tasks: "{{ ansible_os_family }}.yml"
16
17- name: Create dhcpd.conf from template
18 template:
19 src: dhcpd.conf.j2
20 dest: "{{ dhcpd_config_dir }}/dhcpd.conf"
21 backup: true
22 mode: "0644"
23 owner: root
Zack Williams98725e22021-03-18 10:21:26 -070024 group: "{{ dhcpd_groupname }}"
Zack Williams9fc21d72020-11-22 22:36:54 -070025 # validate: 'dhcpd -t -cf %s' # Does not work...
26 notify:
27 - dhcpd-restart
28
29- name: Copy tftpd served files
30 copy:
31 src: "{{ item }}"
32 dest: "{{ tftpd_boot_dir }}/{{ item }}"
33 owner: root
34 group: "{{ tftpd_groupname }}"
35 mode: "0644"
36 with_items: "{{ tftpd_files }}"
37
38- name: Enable and start dhcpd
39 service:
40 name: "{{ dhcpd_service }}"
41 enabled: true
42 state: started
Zack Williams98725e22021-03-18 10:21:26 -070043 arguments: "{{ dhcpd_arguments | default(omit) }}"
Zack Williams9fc21d72020-11-22 22:36:54 -070044
45- name: Enable and start tftpd
46 service:
47 name: "{{ tftpd_service }}"
48 enabled: true
49 state: started
Zack Williams98725e22021-03-18 10:21:26 -070050 arguments: "{{ tftpd_arguments | default(omit) }}"