-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdnsmasq.sls
46 lines (45 loc) · 1.39 KB
/
dnsmasq.sls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
dnsmasq:
pkg.installed: []
file.managed:
- name: /etc/dnsmasq.conf
- user: root
- group: root
- mode: 644
- contents:
# Explicitly bind dnsmasq to the docker0 interface
# upstream DNS servers from /etc/resolv.conf will be used
- bind-interfaces
- interface=docker0
- listen-address=172.17.0.1
# Do not load /etc/hosts
- no-hosts
# Strictly follow the nameserver order in resolv.conf
- strict-order
# Bump up cache size for better performance on systems with enough memory
{% if salt['pillar.get']('dnsmasq:cache-size') %}
- cache-size={{ salt['pillar.get']('dnsmasq:cache-size') }}
{% endif %}
service.running:
- enable: true
- watch:
- pkg: dnsmasq
- file: /etc/dnsmasq.conf
# It's necessary to start dnsmasq after Docker, so the docker0 interface is present.
# Otherwise, we'd get the following errors upon boot:
#
# dnsmasq: failed to create listening socket for 172.17.0.1: Cannot assign requested address
# dnsmasq: unknown interface docker0
dnsmasq_systemd_override:
file.managed:
- name: /etc/systemd/system/dnsmasq.service.d/after-docker.conf
- user: root
- group: root
- mode: 644
- makedirs: true
- contents: |
[Unit]
After=docker.service
cmd.run:
- name: systemctl daemon-reload
onchanges:
- file: dnsmasq_systemd_override