r/hass-dhcp: Clean up DHCP/DNS service
The production deployment of *dnsmasq* for Home Assistant has deviated from how the *hass-dhcp* role configures it. Bringing the role back in sync with how things really are.jenkins-master
parent
ceeb61cdb0
commit
5d7ebbaa05
|
@ -1,5 +1,5 @@
|
||||||
hass_dhcp_range:
|
hass_dhcp_range:
|
||||||
start: 192.168.1.100
|
start: 192.168.1.100
|
||||||
end: 192.168.1.250
|
end: 192.168.1.250
|
||||||
hass_dhcp_lease_time: 1h
|
hass_dhcp_lease_time: 24h
|
||||||
hass_dns_domain: homeassistant.io
|
hass_dns_domain: homeassistant.io
|
||||||
|
|
|
@ -2,3 +2,7 @@
|
||||||
service:
|
service:
|
||||||
name: dnsmasq
|
name: dnsmasq
|
||||||
state: restarted
|
state: restarted
|
||||||
|
- name: reload firewalld
|
||||||
|
command: firewall-cmd --reload
|
||||||
|
- name: save firewalld configuration
|
||||||
|
command: firewall-cmd --runtime-to-permanent
|
||||||
|
|
|
@ -12,3 +12,43 @@
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
notify:
|
notify:
|
||||||
- restart dnsmasq
|
- restart dnsmasq
|
||||||
|
|
||||||
|
- meta: flush_handlers
|
||||||
|
- name: ensure homeassistant firewall zone exists
|
||||||
|
firewalld:
|
||||||
|
zone: homeassistant
|
||||||
|
permanent: true
|
||||||
|
state: present
|
||||||
|
tags:
|
||||||
|
- firewall
|
||||||
|
notify:
|
||||||
|
- reload firewalld
|
||||||
|
- name: ensure homeassistant firewalld zone is configured
|
||||||
|
firewalld:
|
||||||
|
zone: homeassistant
|
||||||
|
interface: '{{ hass_interface }}'
|
||||||
|
permanent: true
|
||||||
|
state: enabled
|
||||||
|
notify:
|
||||||
|
- reload firewalld
|
||||||
|
tags:
|
||||||
|
- firewall
|
||||||
|
- meta: flush_handlers
|
||||||
|
- name: ensure firewall is configured for home assistant services
|
||||||
|
firewalld:
|
||||||
|
zone: homeassistant
|
||||||
|
service: '{{ item }}'
|
||||||
|
immediate: yes
|
||||||
|
permanent: no
|
||||||
|
state: enabled
|
||||||
|
loop:
|
||||||
|
- dhcp
|
||||||
|
- dns
|
||||||
|
- http
|
||||||
|
- https
|
||||||
|
- mdns
|
||||||
|
- mqtt-tls
|
||||||
|
notify:
|
||||||
|
- save firewalld configuration
|
||||||
|
tags:
|
||||||
|
- firewall
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
|
no-resolv
|
||||||
|
no-hosts
|
||||||
interface={{ hass_interface }}
|
interface={{ hass_interface }}
|
||||||
dhcp-range={{ hass_dhcp_range.start }},{{ hass_dhcp_range.end }},{{ hass_dhcp_lease_time }}
|
dhcp-range=set:homeassistant,{{ hass_dhcp_range.start }},{{ hass_dhcp_range.end }},{{ hass_dhcp_lease_time }}
|
||||||
domain={{ hass_dns_domain }}
|
domain={{ hass_dns_domain }},{{ hass_net_cidr }}
|
||||||
|
interface-name={{ homeassistant_server_name }},{{ hass_interface }}
|
||||||
log-queries=extra
|
{% if hass_net_gateway|d %}
|
||||||
|
dhcp-option=option:router,{{ hass_net_gateway }}
|
||||||
|
{% endif %}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
hass_net_cidr: >-
|
||||||
|
{{
|
||||||
|
(
|
||||||
|
ansible_facts[hass_interface].ipv4.network
|
||||||
|
+ '/'
|
||||||
|
+ ansible_facts[hass_interface].ipv4.netmask
|
||||||
|
)
|
||||||
|
| ipaddr('net')
|
||||||
|
}}
|
Loading…
Reference in New Issue