From 92b13e90ed958c2dd9f83f7b0bc215c61628fc46 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Fri, 18 Dec 2020 15:39:36 +0100 Subject: [PATCH] nginx/application: Fixed getting nameserver ips using ansible facts, not custom script --- roles/nginx/application/tasks/main.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/roles/nginx/application/tasks/main.yml b/roles/nginx/application/tasks/main.yml index 036c9ab..700fff9 100644 --- a/roles/nginx/application/tasks/main.yml +++ b/roles/nginx/application/tasks/main.yml @@ -36,12 +36,14 @@ with_items: "{{ nginx_snippets }}" notify: reload nginx -- name: Retrieve dns resolver addresses - shell: >- - echo resolver $(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf) ';' - > {{ nginx_snippets_directory | quote }}/resolver.conf - args: - creates: "{{ nginx_snippets_directory }}/resolver.conf" +- name: Configure dns resolver addresses for nginx + copy: + content: | + resolver {{ ansible_dns.nameservers | ipwrap | join(' ') }}; + dest: "{{ nginx_snippets_directory }}/resolver.conf" + owner: root + group: root + mode: u=rwx,g=rx,o=rx notify: reload nginx - name: Configure validation directory