ansible-dhcpd/tasks/install.yml

31 lines
986 B
YAML
Raw Normal View History

---
- name: Configure DHCP relay in debconf
2024-01-13 16:08:19 +00:00
ansible.builtin.debconf:
name: 'isc-dhcp-relay'
question: 'isc-dhcp-relay/{{ item.key }}'
vtype: 'string'
value: '{{ item.value }}'
with_dict:
2024-01-13 16:08:19 +00:00
servers: '{{ dhcpd_relay_servers | join(" ") }}'
interfaces: '{{ dhcpd_relay_interfaces | join(" ") }}'
2024-01-13 16:08:19 +00:00
options: '{{ dhcpd_relay_options }}'
register: dhcpd_register_relay_debconf
when:
- ansible_os_family == "Debian"
- dhcpd_mode == 'relay'
- name: Install DHCP packages
2024-01-13 16:08:19 +00:00
ansible.builtin.package:
name: '{{ item }}'
state: 'present'
2024-01-13 16:08:19 +00:00
with_community.general.flattened:
- '{{ dhcpd_base_packages_map[dhcpd_mode] }}'
- '{{ dhcpd_base_packages_map["probe"] }}'
- name: Reconfigure ISC DHCP relay
2024-01-13 16:08:19 +00:00
ansible.builtin.command: dpkg-reconfigure --frontend=noninteractive isc-dhcp-relay
notify: ['Restart dhcp relay']
when:
- ansible_os_family == "Debian"
- dhcpd_register_relay_debconf|d() and dhcpd_register_relay_debconf.changed