From f872c13fb7400f2f2e1e20027cc4d2becca46ad0 Mon Sep 17 00:00:00 2001 From: vincent Date: Sun, 5 Jul 2020 12:12:10 +0200 Subject: [PATCH] complete pihole role --- defaults/main.yml | 4 ++-- handlers/main.yml | 2 +- tasks/main.yml | 13 ++++++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 143ca21..25b8be1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -8,8 +8,8 @@ pihole_admin_password: pihole_host_dir_dnsmasqd: /etc/docker-{{pihole_container_name}}/dnsmasq.d/ pihole_host_dir_pihole: /etc/docker-{{pihole_container_name}}/pihole/ pihole_volumes: - - "{{ docker_pihole_host_dir_pihole }}:/etc/pihole/" - - "{{ docker_pihole_host_dir_dnsmasqd }}:/etc/dnsmasq.d/" + - "{{ pihole_host_dir_pihole }}:/etc/pihole/" + - "{{ pihole_host_dir_dnsmasqd }}:/etc/dnsmasq.d/" pihole_http_port: 8090 pihole_port: - "53:53/tcp" diff --git a/handlers/main.yml b/handlers/main.yml index 2da9cb2..0bcb1a2 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -3,6 +3,6 @@ - name: restart pihole container docker_container: - name: "{{ docker_pihole_container_name }}" + name: "{{ pihole_container_name }}" state: started restart: yes \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index 358a048..5f2240a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,13 @@ --- # tasks file for ansible-pihole +- name: Stop bind service + service: + name: named + state: stopped + enabled: no + failed_when: no + - name: "Set the __docker_pihole_admin_password fact" set_fact: __docker_pihole_random_password: "{{ lookup('password', '/dev/null chars=ascii_letters,digits') }}" @@ -23,12 +30,12 @@ capabilities: - NET_ADMIN dns_servers: "{{ pihole_dns_servers }}" - + become: yes - name: "add custom dnsmask file" template: - dest: "{{pihole_host_dir_dnsmasqd}}" # required. Location to render the template to on the remote machine. + dest: "{{pihole_host_dir_dnsmasqd}}/02-localresolver.conf" # required. Location to render the template to on the remote machine. src: 02-localresolver.conf.j2 # required. Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or absolute path. when: pihole_local_resolver is defined notify: restart pihole container - \ No newline at end of file + become: yes \ No newline at end of file