dhcp: update role to template subnet configuration correctly
This commit is contained in:
parent
ce9572631d
commit
adf511a35f
8
dhcp_server.yml
Normal file
8
dhcp_server.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: "Setup ISC-DHCP for the internal network"
|
||||||
|
hosts: dhcp_server
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- dhcp
|
||||||
|
|
@ -13,6 +13,7 @@
|
|||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
setype: dhcp_etc_t
|
setype: dhcp_etc_t
|
||||||
|
validate: dhcpd -t
|
||||||
|
|
||||||
- name: Restart & enable DHCP-server
|
- name: Restart & enable DHCP-server
|
||||||
systemd:
|
systemd:
|
||||||
|
@ -21,6 +21,7 @@ option domain-name-servers {{ dhcp_common_name_servers|join(', ') }};
|
|||||||
log-facility local7;
|
log-facility local7;
|
||||||
|
|
||||||
# Subnet definitions
|
# Subnet definitions
|
||||||
|
|
||||||
{% for subnet in dhcp_subnets %}
|
{% for subnet in dhcp_subnets %}
|
||||||
subnet {{ subnet.net }} netmask {{ subnet.netmask }} {
|
subnet {{ subnet.net }} netmask {{ subnet.netmask }} {
|
||||||
option routers {{ subnet.routers }};
|
option routers {{ subnet.routers }};
|
||||||
@ -28,7 +29,7 @@ subnet {{ subnet.net }} netmask {{ subnet.netmask }} {
|
|||||||
option domain-name "{{ subnet.domain_name }}";
|
option domain-name "{{ subnet.domain_name }}";
|
||||||
option domain-name-servers {{ subnet.domain_name_servers|join(', ') }};
|
option domain-name-servers {{ subnet.domain_name_servers|join(', ') }};
|
||||||
{% if subnet.domain_search is defined and subnet.domain_search|length > 0 %}
|
{% if subnet.domain_search is defined and subnet.domain_search|length > 0 %}
|
||||||
option domain-search {{ subnet.domain_search | map('regex_replace', '(.*)', '\"\\1\"') | join(', ') }};
|
option domain-search {{ subnet.domain_search | map('regex_replace', '^(.*)$', '\"\\1\"') | join(', ') }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if subnet.range_start is defined and subnet.range_end is defined %}
|
{% if subnet.range_start is defined and subnet.range_end is defined %}
|
||||||
@ -50,5 +51,6 @@ subnet {{ subnet.net }} netmask {{ subnet.netmask }} {
|
|||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
}
|
}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user