From 817bb2df9606bc17929d04b927e4dca2934b3399 Mon Sep 17 00:00:00 2001 From: binary Date: Fri, 5 Mar 2021 19:53:13 +0100 Subject: Refactor dns role --- roles/dns/defaults/main.yml | 9 +++++++++ roles/dns/tasks/main.yml | 6 +++--- roles/dns/templates/resolv.conf.j2 | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 roles/dns/defaults/main.yml (limited to 'roles') 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] }} -- cgit v1.2.3