-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdnsmasq.yml
executable file
·95 lines (83 loc) · 2.21 KB
/
dnsmasq.yml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env ansible-playbook
---
- name: caching DNS setup
hosts: pladd-laptop
vars_files:
- passwords.vault
###### NONE OF THIS IS NEEDED AS OF FEDORA 33 - IT USES systemd-resolved instead of dnsmasq
tasks:
- name: fail if vault not decrypted
fail: msg="Vault not decrypted"
when: ansible_become_password is undefined
- name: dnsmasq package
package: name={{ item }} state=latest
with_items:
- dnsmasq
- name: NetworkManager config
blockinfile:
path: /etc/NetworkManager/conf.d/use-dnsmasq.conf
create: yes
block: |
[main]
dns=dnsmasq
notify:
- reload NetworkManager
- name: dnsmasq_settings
blockinfile:
path: /etc/NetworkManager/dnsmasq.d/settings.conf
create: yes
block: |
log-facility=/var/log/dnsmasq.log
domain-needed
bogus-priv
strict-order
local=/local/
expand-hosts
notify:
- reload NetworkManager
- name: debug_logging
blockinfile:
path: /etc/NetworkManager/dnsmasq.d/debug-logging.conf
create: yes
block: |
log-queries=extra
notify:
- reload NetworkManager
- name: rotate_debug_logs
blockinfile:
path: /etc/logrotate.d/dnsmasq
create: yes
block: |
/var/log/dnsmasq.log {
rotate 14
daily
notifempty
maxsize 1G
delaycompress
sharedscripts
postrotate
[ ! -f /var/run/NetworkManager/dnsmasq.pid ] || kill -USR2 `cat /var/run/NetworkManager/dnsmasq.pid`
endscript
}
- name: etc_hosts
lineinfile:
path: /etc/NetworkManager/dnsmasq.d/etc-hosts.conf
create: yes
line: addn-hosts=/etc/hosts
notify:
- reload NetworkManager
- name: force_local_dns_for_home.pladd.net
blockinfile:
path: /etc/NetworkManager/dnsmasq.d/home.pladd.net.conf
create: yes
block: |
server=/home.pladd.net/192.168.42.59
notify:
- reload NetworkManager
# Used https://fedoramagazine.org/using-the-networkmanagers-dnsmasq-plugin/ for some parts
handlers:
- name: reload NetworkManager
service:
name: NetworkManager
state: reloaded
...