Feat: deploy nas pihole docker-compose
This commit is contained in:
parent
bde73c9601
commit
5b3faafcb1
5
home.yml
5
home.yml
@ -36,6 +36,11 @@
|
||||
tags:
|
||||
- docker
|
||||
|
||||
- role: pihole
|
||||
tags:
|
||||
- docker
|
||||
- pihole
|
||||
|
||||
tasks:
|
||||
- name: Include user
|
||||
include_role:
|
||||
|
@ -18,4 +18,3 @@
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart nut-server
|
||||
|
||||
|
12
roles/pihole/defaults/main.yml
Normal file
12
roles/pihole/defaults/main.yml
Normal 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
|
23
roles/pihole/tasks/main.yml
Normal file
23
roles/pihole/tasks/main.yml
Normal 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
|
36
roles/pihole/templates/docker-compose.j2.yml
Normal file
36
roles/pihole/templates/docker-compose.j2.yml
Normal 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
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user