blob: c33ddc489909e00b11955b1b071c295db0cf9190 [file] [log] [blame]
---
# dhcpd tasks/main.yml
#
# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
# SPDX-License-Identifier: Apache-2.0
- name: include OS-specific vars
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}_{{ ansible_distribution_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- name: include OS-specific tasks
include_tasks: "{{ ansible_os_family }}.yml"
- name: Create dhcpd.conf from template
template:
src: dhcpd.conf.j2
dest: "{{ dhcpd_config_dir }}/dhcpd.conf"
backup: true
mode: "0644"
owner: root
group: "{{ dhcpd_groupname }}"
# validate: 'dhcpd -t -cf %s' # Does not work...
notify:
- dhcpd-restart
- name: Copy tftpd served files
copy:
src: "{{ item }}"
dest: "{{ tftpd_boot_dir }}/{{ item }}"
owner: root
group: "{{ tftpd_groupname }}"
mode: "0644"
with_items: "{{ tftpd_files }}"
- name: Enable and start dhcpd
service:
name: "{{ dhcpd_service }}"
enabled: true
state: started
arguments: "{{ dhcpd_arguments | default(omit) }}"
- name: Enable and start tftpd
service:
name: "{{ tftpd_service }}"
enabled: true
state: started
arguments: "{{ tftpd_arguments | default(omit) }}"