complete pihole role

This commit is contained in:
vincent 2020-07-05 12:12:10 +02:00
parent 10ac6fe6f4
commit f872c13fb7
3 changed files with 13 additions and 6 deletions

View File

@ -8,8 +8,8 @@ pihole_admin_password:
pihole_host_dir_dnsmasqd: /etc/docker-{{pihole_container_name}}/dnsmasq.d/ pihole_host_dir_dnsmasqd: /etc/docker-{{pihole_container_name}}/dnsmasq.d/
pihole_host_dir_pihole: /etc/docker-{{pihole_container_name}}/pihole/ pihole_host_dir_pihole: /etc/docker-{{pihole_container_name}}/pihole/
pihole_volumes: pihole_volumes:
- "{{ docker_pihole_host_dir_pihole }}:/etc/pihole/" - "{{ pihole_host_dir_pihole }}:/etc/pihole/"
- "{{ docker_pihole_host_dir_dnsmasqd }}:/etc/dnsmasq.d/" - "{{ pihole_host_dir_dnsmasqd }}:/etc/dnsmasq.d/"
pihole_http_port: 8090 pihole_http_port: 8090
pihole_port: pihole_port:
- "53:53/tcp" - "53:53/tcp"

View File

@ -3,6 +3,6 @@
- name: restart pihole container - name: restart pihole container
docker_container: docker_container:
name: "{{ docker_pihole_container_name }}" name: "{{ pihole_container_name }}"
state: started state: started
restart: yes restart: yes

View File

@ -1,6 +1,13 @@
--- ---
# tasks file for ansible-pihole # 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" - name: "Set the __docker_pihole_admin_password fact"
set_fact: set_fact:
__docker_pihole_random_password: "{{ lookup('password', '/dev/null chars=ascii_letters,digits') }}" __docker_pihole_random_password: "{{ lookup('password', '/dev/null chars=ascii_letters,digits') }}"
@ -23,12 +30,12 @@
capabilities: capabilities:
- NET_ADMIN - NET_ADMIN
dns_servers: "{{ pihole_dns_servers }}" dns_servers: "{{ pihole_dns_servers }}"
become: yes
- name: "add custom dnsmask file" - name: "add custom dnsmask file"
template: 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. 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 when: pihole_local_resolver is defined
notify: restart pihole container notify: restart pihole container
become: yes