56 lines
1.4 KiB
YAML
56 lines
1.4 KiB
YAML
|
---
|
||
|
- name: Deploy PiHole
|
||
|
hosts: pihole
|
||
|
become: true
|
||
|
vars:
|
||
|
image: pihole/pihole:v5.2.1
|
||
|
tasks:
|
||
|
- name: stop containers
|
||
|
docker_container:
|
||
|
name: pihole_app_1
|
||
|
state: absent
|
||
|
ignore_errors: true
|
||
|
|
||
|
- name: Pull images
|
||
|
docker_image:
|
||
|
name: "{{ image }}"
|
||
|
source: pull
|
||
|
|
||
|
- name: Disable resolved for pihole
|
||
|
shell: sed -r -i.orig 's/#?DNSStubListener=yes/DNSStubListener=no/g' /etc/systemd/resolved.conf
|
||
|
|
||
|
- name: Update local resolved config
|
||
|
shell: sh -c 'rm /etc/resolv.conf && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf'
|
||
|
|
||
|
- name: restart resolved
|
||
|
systemd:
|
||
|
name: systemd-resolved
|
||
|
state: restarted
|
||
|
|
||
|
- name: deploy containers
|
||
|
docker_compose:
|
||
|
project_name: pihole
|
||
|
definition:
|
||
|
version: "2"
|
||
|
|
||
|
services:
|
||
|
app:
|
||
|
image: "{{ image }}"
|
||
|
ports:
|
||
|
- "53:53/tcp"
|
||
|
- "53:53/udp"
|
||
|
- "67:67/udp"
|
||
|
- "80:80/tcp"
|
||
|
- "443:443/tcp"
|
||
|
environment:
|
||
|
TZ: 'America/Los_Angeles'
|
||
|
WEBPASSWORD: 'pihole'
|
||
|
volumes:
|
||
|
- /docker/pihole/etc/pihole/:/etc/pihole/
|
||
|
- /docker/pihole/etc/dnsmasq:/etc/dnsmasq.d/
|
||
|
restart: always
|
||
|
#network_mode: host
|
||
|
|
||
|
|
||
|
|