add pihole image update

This commit is contained in:
vincent 2020-11-28 16:17:16 +01:00
parent e229d4b6ba
commit 1580ac41d7
2 changed files with 15 additions and 1 deletions

View File

@ -25,4 +25,5 @@ pihole_local_reverse_domain: '1.168.192.in-addr.arpa'
pihole_local_resolver:
pihole_dns_servers:
- '127.0.0.1'
- '{{pihole_local_resolver | default(1.1.1.1)}}'
- '{{pihole_local_resolver | default(1.1.1.1)}}'
pihole_update_container: false

View File

@ -14,6 +14,13 @@
__docker_pihole_random_password: "{{ lookup('password', '/dev/null chars=ascii_letters,digits') }}"
__docker_pihole_admin_password: "{{ pihole_admin_password | default(__docker_pihole_random_password) }}"
- name: update image if needed
docker_image:
image: "{{ pihole_image_name }}"
force: yes
when: pihole_update_container == True
- name: "[docker] Setup the pi-hole docker container"
docker_container:
name: "{{ pihole_container_name }}"
@ -33,6 +40,12 @@
dns_servers: "{{ pihole_dns_servers }}"
become: yes
- name: cleanup old image
docker_prune:
images: yes
when: pihole_update_container == True
- name: "add custom dnsmask file"
template:
dest: "{{pihole_host_dir_dnsmasqd}}/02-localresolver.conf" # required. Location to render the template to on the remote machine.