Add task for custom DNS servers
This commit is contained in:
parent
df52dc0f85
commit
1755e38aed
4 changed files with 33 additions and 0 deletions
6
files/etc/systemd/resolved.conf.d/custom_dns.conf
Normal file
6
files/etc/systemd/resolved.conf.d/custom_dns.conf
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[Resolve]
|
||||||
|
DNS=193.110.81.0 #dns0.eu
|
||||||
|
DNS=185.253.5.0 #dns0.eu
|
||||||
|
FallbackDNS=1.1.1.1 #cloudflare
|
||||||
|
FallbackDNS=1.0.0.1 #cloudflare
|
||||||
|
DNSOverTLS=yes
|
23
tasks/dns.yml
Normal file
23
tasks/dns.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
- name: Create directory for systemd-resolved
|
||||||
|
file:
|
||||||
|
path: /etc/systemd/resolved.conf.d
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: Add custom DNS server config
|
||||||
|
copy:
|
||||||
|
src: etc/systemd/resolved.conf.d/custom_dns.conf
|
||||||
|
dest: /etc/systemd/resolved.conf.d/custom_dns.conf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
register: config_change
|
||||||
|
|
||||||
|
- name: Reload DNS daemon after file change
|
||||||
|
systemd:
|
||||||
|
name: systemd-resolved.service
|
||||||
|
daemon_reload: yes
|
||||||
|
state: restarted
|
||||||
|
when: config_change.changed
|
|
@ -1,6 +1,9 @@
|
||||||
- name: base config
|
- name: base config
|
||||||
import_tasks: config.yml
|
import_tasks: config.yml
|
||||||
|
|
||||||
|
- name: custom DNS servers
|
||||||
|
import_tasks: dns.yml
|
||||||
|
|
||||||
- name: install packages
|
- name: install packages
|
||||||
import_tasks: packages.yml
|
import_tasks: packages.yml
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
cache_valid_time: 3600
|
cache_valid_time: 3600
|
||||||
state: present
|
state: present
|
||||||
name:
|
name:
|
||||||
|
- systemd-resolved
|
||||||
- cron
|
- cron
|
||||||
- curl
|
- curl
|
||||||
- ca-certificates
|
- ca-certificates
|
||||||
|
|
Loading…
Reference in a new issue