Feat: deploy nas pihole docker-compose

This commit is contained in:
Bertrand Benjamin 2022-06-04 06:36:34 +02:00
parent bde73c9601
commit 5b3faafcb1
6 changed files with 83 additions and 1 deletions

View File

@ -36,6 +36,11 @@
tags:
- docker
- role: pihole
tags:
- docker
- pihole
tasks:
- name: Include user
include_role:

View File

@ -18,4 +18,3 @@
group: root
mode: 0644
notify: restart nut-server

View File

@ -0,0 +1,12 @@
---
# directories
pihole_container_name: pihole
pihole_data_directory: "{{ docker_home }}/pihole"
pihole_docker_image: pihole/pihole:2022.05
pihole_hostname: pihole
pihole_domainname: lan
pihole_ip: 192.168.2.2
pihole_TZ: 'France/Paris'
pihole_subnet: 192.168.2.0/24
pihole_gateway: 192.168.2.1

View File

@ -0,0 +1,23 @@
---
# tasks file for pihole
- name: Create pihole Directories
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ pihole_data_directory }}"
- "{{ pihole_data_directory }}/pihole"
- "{{ pihole_data_directory }}/dnsmasq.d"
- name: Copy docker-compose.yml
template:
src: docker-compose.j2.yml
dest: "{{ pihole_data_directory }}/docker-compose.yml"
owner: root
group: root
mode: 0644
# - name: Start docker-compose
# docker_compose:
# project_src: "{{ pihole_data_directory }}"
# when: pihole

View File

@ -0,0 +1,36 @@
---
services:
pihole:
container_name: {{ pihole_container_name }}
image: {{ pihole_docker_image }}
hostname: {{ pihole_hostname }}
domainname: {{ pihole_domainname }}
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
- "80:80/tcp"
- "443:443/tcp"
environment:
TZ: {{ pihole_TZ }}
ServerIP: {{ pihole_ip }}
volumes:
- './pihole/:/etc/pihole/'
- './dnsmasq.d/:/etc/dnsmasq.d/'
cap_add:
- NET_ADMIN
restart: unless-stopped
networks:
pihole-macvlan:
ipv4_address: {{ pihole_ip }}
networks:
pihole-macvlan:
driver: macvlan
driver_opts:
parent: eth0
ipam:
config:
- subnet: {{ pihole_subnet }}
gateway: {{ pihole_gateway }}
ip_range: {{ pihole_ip }}/32

View File

@ -1,11 +1,18 @@
---
# Docker install
docker_apt_arch: arm64
docker_compose_version: "v2.6.0"
docker_compose_arch: armv6
docker_users:
- "{{ admin.username }}"
docker_home: /var/docker
# Pihole
pihole_docker_image: pihole/pihole:2022.05
pihole_ip: 192.168.2.202
# Nut
upss:
- name: eaton650
driver: usbhid-ups