diff options
author | binary <me@rgoncalves.se> | 2021-03-05 19:53:13 +0100 |
---|---|---|
committer | binary <me@rgoncalves.se> | 2021-03-05 19:53:13 +0100 |
commit | 817bb2df9606bc17929d04b927e4dca2934b3399 (patch) | |
tree | d88c9effb7b1308a110912121bfa83888bba1557 | |
parent | dc511c3bde7a641b772b3e6529f092368b4bd665 (diff) | |
download | infrastructure-817bb2df9606bc17929d04b927e4dca2934b3399.tar.gz |
Refactor dns role
-rw-r--r-- | roles/dns/defaults/main.yml | 9 | ||||
-rw-r--r-- | roles/dns/tasks/main.yml | 6 | ||||
-rw-r--r-- | roles/dns/templates/resolv.conf.j2 | 4 |
3 files changed, 14 insertions, 5 deletions
diff --git a/roles/dns/defaults/main.yml b/roles/dns/defaults/main.yml new file mode 100644 index 0000000..3928589 --- /dev/null +++ b/roles/dns/defaults/main.yml @@ -0,0 +1,9 @@ + +# dns ~~ roles/dns/defaults/vars.yml +# default dns + +--- + +dns_dns: + - 8.8.8.8 + - 1.1.1.1 diff --git a/roles/dns/tasks/main.yml b/roles/dns/tasks/main.yml index 3e84009..1b18833 100644 --- a/roles/dns/tasks/main.yml +++ b/roles/dns/tasks/main.yml @@ -8,9 +8,9 @@ template: src: resolv.conf.j2 dest: /etc/resolv.conf - owner: "{{ user_root }}" - group: "{{ group_root }}" - mode: 0644 + owner: "0" + group: "0" + mode: "0644" - name: check dns resolution shell: ping -c 1 google.com diff --git a/roles/dns/templates/resolv.conf.j2 b/roles/dns/templates/resolv.conf.j2 index f7240e7..b789e8a 100644 --- a/roles/dns/templates/resolv.conf.j2 +++ b/roles/dns/templates/resolv.conf.j2 @@ -2,6 +2,6 @@ # resolv configuration ~~ /etc/resolv.conf # managed by Ansible -nameserver {{ global.dns[0] }} -nameserver {{ global.dns[1] }} +nameserver {{ dns_dns[0] }} +nameserver {{ dns_dns[1] }} |