2017-09-20 23:56:00 +00:00
|
|
|
---
|
|
|
|
- name: Configure DHCP relay in debconf
|
2024-01-13 16:08:19 +00:00
|
|
|
ansible.builtin.debconf:
|
2017-09-20 23:56:00 +00:00
|
|
|
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(" ") }}'
|
2017-09-20 23:56:00 +00:00
|
|
|
interfaces: '{{ dhcpd_relay_interfaces | join(" ") }}'
|
2024-01-13 16:08:19 +00:00
|
|
|
options: '{{ dhcpd_relay_options }}'
|
2017-09-20 23:56:00 +00:00
|
|
|
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:
|
2017-09-20 23:56:00 +00:00
|
|
|
name: '{{ item }}'
|
|
|
|
state: 'present'
|
2024-01-13 16:08:19 +00:00
|
|
|
with_community.general.flattened:
|
2017-09-20 23:56:00 +00:00
|
|
|
- '{{ 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']
|
2017-09-20 23:56:00 +00:00
|
|
|
when:
|
|
|
|
- ansible_os_family == "Debian"
|
|
|
|
- dhcpd_register_relay_debconf|d() and dhcpd_register_relay_debconf.changed
|