42 lines
1 KiB
YAML
42 lines
1 KiB
YAML
# vim: ft=yaml.ansible
|
|
---
|
|
- name: Create Pi-hole volume directories
|
|
ansible.builtin.file:
|
|
name: "{{ services.pihole.volume }}/{{ dir }}"
|
|
owner: root
|
|
mode: u=rwx,g=rx,o=rx
|
|
state: directory
|
|
loop:
|
|
- pihole
|
|
- dnsmasq.d
|
|
loop_control:
|
|
loop_var: dir
|
|
|
|
- name: Create Docker network for Pi-hole
|
|
community.docker.docker_network:
|
|
name: pi-hole
|
|
state: present
|
|
|
|
- name: Deploy Pi-hole Docker container
|
|
community.docker.docker_container:
|
|
name: pi-hole
|
|
state: "{{ 'absent' if stop is defined and stop else 'started' }}"
|
|
restart: "{{ stop is undefined or not stop }}"
|
|
image: pihole/pihole:{{ services.pihole.version }}
|
|
restart_policy: always
|
|
default_host_ip: ''
|
|
networks:
|
|
- name: pi-hole
|
|
env:
|
|
DNSMASQ_LISTENING: all
|
|
TZ: "{{ timezone }}"
|
|
volumes:
|
|
- "{{ services.pihole.volume }}/pihole:/etc/pihole:rw"
|
|
- "{{ services.pihole.volume }}/dnsmasq.d:/etc/dnsmasq.d:rw"
|
|
published_ports:
|
|
- 53:53/tcp
|
|
- 53:53/udo
|
|
- 81:80/tcp
|
|
capabilities:
|
|
- net_admin
|