Adguard updated, adguardhome-sync added

This commit is contained in:
Annika Merris 2026-01-13 10:39:36 -05:00
parent b829f66402
commit e5443b7bc3
23 changed files with 156 additions and 58 deletions

View file

@ -1,4 +1,4 @@
an# Adhdgirl Minilab Ansible Project # Adhdgirl Minilab Ansible Project
## To Get Machines Added ## To Get Machines Added

View file

@ -4,7 +4,7 @@
tags: always tags: always
with_first_found: with_first_found:
- files: - files:
- "{{ ansible_distribution }}.yaml" - "{{ ansible_facts['distribution'] }}.yaml"
skip: true skip: true
- name: Ensure AdGuard Home is running on this device - name: Ensure AdGuard Home is running on this device
@ -22,8 +22,8 @@
- "confdir" - "confdir"
- name: Ensure compose file is available on the server - name: Ensure compose file is available on the server
tags: docker,adguard,settings tags: docker,adguard,settings
ansible.builtin.copy: ansible.builtin.template:
src: docker-compose.yaml src: docker-compose.yaml.j2
dest: /opt/adguard/docker-compose.yaml dest: /opt/adguard/docker-compose.yaml
owner: root owner: root
group: root group: root

View file

@ -1,7 +1,7 @@
--- ---
services: services:
adguard: adguard:
image: adguard/adguardhome:v0.107.59 image: adguard/adguardhome:{{ adguardhome_version }}
container_name: adguardhome container_name: adguardhome
volumes: volumes:
- /opt/adguard/workdir:/opt/adguardhome/work - /opt/adguard/workdir:/opt/adguardhome/work

View file

@ -0,0 +1,3 @@
---
adguardhome_version: v0.107.71
# code: language=ansible

View file

@ -0,0 +1,11 @@
---
services:
adguardhome-sync:
image: ghcr.io/bakito/adguardhome-sync:v0.8.2
container_name: adguardhome-sync
command: run --config /config/adguardhome-sync.yaml
volumes:
- /opt/adguardhome-sync/config/adguardhome-sync.yaml:/config/adguardhome-sync.yaml
ports:
- 8080:8080
restart: unless-stopped

View file

@ -0,0 +1,45 @@
---
- name: Load distro-specific variables
ansible.builtin.include_vars: '{{ item }}'
tags: always
with_first_found:
- files:
- "{{ ansible_facts['distribution'] }}.yaml"
skip: true
- name: Ensure AdGuard Home is running on this device
block:
- name: Ensure presense of folders for AdGuard Home Sync
tags: packages,docker,adguard
ansible.builtin.file:
path: "/opt/adguardhome-sync/config"
state: directory
recurse: true
owner: root
group: root
- name: Ensure compose file is available on the server
tags: docker,adguard,settings
ansible.builtin.copy:
src: docker-compose.yaml
dest: /opt/adguardhome-sync/docker-compose.yaml
owner: root
group: root
mode: u=rw,g=r,o=r
- name: Ensure AdguardHome-Sync config is available
tags: docker,adguard,settings
ansible.builtin.template:
src: adguardhome-sync.yaml.j2
dest: /opt/adguardhome-sync/config/adguardhome-sync.yaml
owner: root
group: root
mode: u=rw,g=r,o=r
- name: Ensure docker containers are pulled and running
tags: docker,adguard
community.docker.docker_compose_v2:
project_src: /opt/adguardhome-sync
pull: always
rescue:
- name: Set that this task failed
ansible.builtin.set_fact:
task_failed: true

View file

@ -0,0 +1,14 @@
---
cron: "0 */2 * * *"
runOnStart: true
continueOnError: true
origin:
url: http://10.69.2.4:80
username: {{ adguardhome_sync_user_name }}
password: {{ adguardhome_sync_user_password }}
replicas:
- url: http://10.69.9.12:80
username: {{ adguardhome_sync_user_name }}
password: {{ adguardhome_sync_user_password}}
autoSetup: true
interfaceName: eth0

View file

@ -0,0 +1,9 @@
---
adguardhome_sync_user_name: adhdgirl
adguardhome_sync_user_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
39313537373231343839663162373238343837626266323631316234333034343536636664336433
3531626364383166383165613563373435623663366461360a613731663639633966353239303933
63353537626461383332656265653634656530326133646361643365366665353562396536373834
3866343531323237360a353737303766393338353436353864336538373166366637663566363166
6364

View file

@ -4,7 +4,7 @@
tags: always tags: always
with_first_found: with_first_found:
- files: - files:
- "{{ ansible_distribution }}.yaml" - "{{ ansible_facts['distribution'] }}.yaml"
skip: true skip: true
- name: Ensure Authentik is running on this device - name: Ensure Authentik is running on this device

View file

@ -4,7 +4,7 @@
tags: always tags: always
with_first_found: with_first_found:
- files: - files:
- "{{ ansible_distribution }}.yaml" - "{{ ansible_facts['distribution'] }}.yaml"
skip: true skip: true
- name: Ensure Caddy is running on this device - name: Ensure Caddy is running on this device

View file

@ -18,7 +18,7 @@ pve.local.cobb.lgbt {
} }
code.local.cobb.lgbt { code.local.cobb.lgbt {
reverse_proxy 10.69.11.51:8443 reverse_proxy 10.69.2.51:8443
} }
guac.local.cobb.lgbt { guac.local.cobb.lgbt {

View file

@ -4,7 +4,7 @@
tags: always tags: always
with_first_found: with_first_found:
- files: - files:
- "{{ ansible_distribution }}.yaml" - "{{ ansible_facts['distribution'] }}.yaml"
skip: true skip: true
- name: Ensure coder is installed on hosts - name: Ensure coder is installed on hosts

View file

@ -23,4 +23,4 @@ coder_sudo_hashed_password: !vault |
3762 3762
coder_proxy_domain: coder.local.cobb.lgbt coder_proxy_domain: coder.local.cobb.lgbt
coder_default_workspace: /workspace coder_default_workspace: /workspace
coder_version: 4.100.0 coder_version: 4.106.3

View file

@ -4,7 +4,7 @@
ansible.builtin.apt: ansible.builtin.apt:
name: aptitude name: aptitude
state: present state: present
when: ansible_distribution in debian_derivatives when: ansible_facts["distribution"] in debian_derivatives
- name: Make sure sudo and ssh are available - name: Make sure sudo and ssh are available
tags: packages,system,settings tags: packages,system,settings
ansible.builtin.package: ansible.builtin.package:
@ -18,19 +18,19 @@
name: name:
- python3 - python3
state: present state: present
when: ansible_distribution == 'Alpine' when: ansible_facts["distribution"] == 'Alpine'
- name: Ensure ssh is starting at boot (Alpine) - name: Ensure ssh is starting at boot (Alpine)
tags: packages,system,settings tags: packages,system,settings
ansible.builtin.service: ansible.builtin.service:
name: sshd name: sshd
state: started state: started
enabled: true enabled: true
when: ansible_distribution == 'Alpine' when: ansible_facts["distribution"] == 'Alpine'
- name: Ensure ssh is starting at boot (Debian) - name: Ensure ssh is starting at boot (Debian)
tags: package,system,settings tags: package,system,settings
ansible.builtin.systemd_service: ansible.builtin.systemd_service:
name: ssh name: ssh
state: started state: started
enabled: true enabled: true
when: ansible_distribution in debian_derivatives when: ansible_facts["distribution"] in debian_derivatives
# code: language=ansible # code: language=ansible

View file

@ -12,7 +12,7 @@
owner: root owner: root
group: root group: root
mode: u=r,g=r,o-rwx mode: u=r,g=r,o-rwx
when: ansible_distribution in debian_derivatives when: ansible_facts["distribution"] in debian_derivatives
- name: Add doas file - name: Add doas file
tags: ansible,settings,doas,system,users tags: ansible,settings,doas,system,users
ansible.builtin.copy: ansible.builtin.copy:
@ -21,7 +21,7 @@
owner: root owner: root
group: root group: root
mode: u=r,g=r,o-rwx mode: u=r,g=r,o-rwx
when: ansible_distribution == "Alpine" when: ansible_facts["distribution"] == "Alpine"
- name: Set authorized key for ansible user - name: Set authorized key for ansible user
tags: users,system,ansible tags: users,system,ansible
ansible.posix.authorized_key: ansible.posix.authorized_key:

View file

@ -4,7 +4,7 @@
tags: always tags: always
with_first_found: with_first_found:
- files: - files:
- "{{ ansible_distribution }}.yaml" - "{{ ansible_facts['distribution'] }}.yaml"
skip: true skip: true
- name: Set up common functionality - name: Set up common functionality
@ -29,18 +29,17 @@
ansible.builtin.hostname: ansible.builtin.hostname:
name: "{{ server_name }}" name: "{{ server_name }}"
use: "alpine" use: "alpine"
when: ansible_distribution == "Alpine" when: ansible_facts["distribution"] == "Alpine"
- name: Ensure the correct hostname is set for host (Debian) - name: Ensure the correct hostname is set for host (Debian)
ansible.builtin.hostname: ansible.builtin.hostname:
name: "{{ server_name }}" name: "{{ server_name }}"
use: "debian" use: "debian"
when: ansible_distribution in debian_derivatives when: ansible_facts["distribution"] in debian_derivatives
# Install software not specific to Ansible # Install software not specific to Ansible
# - name: Ensure software wanted on all hosts is installed # - name: Ensure software wanted on all hosts is installed
# ansible.builtin.import_tasks: general/software.yaml # ansible.builtin.import_tasks: general/software.yaml
rescue: rescue:
- name: Set that this task failed - name: Set that this task failed
ansible.builtin.set_fact: ansible.builtin.set_fact:

View file

@ -7,7 +7,7 @@
ansible.builtin.user: ansible.builtin.user:
name: "{{ user_name }}" name: "{{ user_name }}"
check_mode: true check_mode: true
register: user_exists register: common_user_exists
- name: Ensure group exists - name: Ensure group exists
tags: groups,users tags: groups,users
ansible.builtin.group: ansible.builtin.group:
@ -25,19 +25,19 @@
ansible.builtin.user: ansible.builtin.user:
name: "{{ user_name }}" name: "{{ user_name }}"
password: "{{ common_user_password | string | password_hash('sha512') }}" password: "{{ common_user_password | string | password_hash('sha512') }}"
when: user_exists.state is undefined or user_exists.state != 'present' when: common_user_exists.state is undefined or common_user_exists.state != 'present'
- name: Adjust shell for Debian hosts - name: Adjust shell for Debian hosts
tags: settings,users,debian tags: settings,users,debian
ansible.builtin.user: ansible.builtin.user:
name: "{{ user_name }}" name: "{{ user_name }}"
shell: /bin/bash shell: /bin/bash
when: ansible_distribution in debian_derivatives when: ansible_facts["distribution"] in debian_derivatives
- name: Adjust shell for Ansible hosts - name: Adjust shell for Ansible hosts
tags: settings,users,alpine tags: settings,users,alpine
ansible.builtin.user: ansible.builtin.user:
name: "{{ user_name }}" name: "{{ user_name }}"
shell: /bin/ash shell: /bin/ash
when: ansible_distribution == "Alpine" when: ansible_facts["distribution"] == "Alpine"
- name: Ensure user sudoers file is in place for Debian hosts - name: Ensure user sudoers file is in place for Debian hosts
tags: settings,users,debian tags: settings,users,debian
ansible.builtin.copy: ansible.builtin.copy:
@ -46,7 +46,7 @@
owner: root owner: root
group: root group: root
mode: u=r,g=r,o-rwx mode: u=r,g=r,o-rwx
when: ansible_distribution in debian_derivatives when: ansible_facts["distribution"] in debian_derivatives
- name: Ensure user doas config is in place for Alpine hosts - name: Ensure user doas config is in place for Alpine hosts
tags: settings,users,alpine tags: settings,users,alpine
ansible.builtin.copy: ansible.builtin.copy:
@ -55,7 +55,7 @@
owner: root owner: root
group: root group: root
mode: u=r,g=r,o-rwx mode: u=r,g=r,o-rwx
when: ansible_distribution == "Alpine" when: ansible_facts["distribution"] == "Alpine"
- name: Ensure public keys are available for this user - name: Ensure public keys are available for this user
tags: settings,users,ssh tags: settings,users,ssh
ansible.posix.authorized_key: ansible.posix.authorized_key:
@ -68,12 +68,12 @@
ansible.builtin.group: ansible.builtin.group:
name: "docker" name: "docker"
check_mode: true check_mode: true
register: docker_group_exists register: common_docker_group_exists
- name: If docker group exists, add {{ user_name }} - name: If docker group exists, add {{ user_name }}
ansible.builtin.user: ansible.builtin.user:
name: "{{ user_name }}" name: "{{ user_name }}"
append: true append: true
groups: docker groups: docker
when: docker_group_exists.state == 'present' when: common_docker_group_exists is defined and common_docker_group_exists.state == 'present'
# code: language=ansible # code: language=ansible

View file

@ -22,7 +22,7 @@
name: docker name: docker
types: deb types: deb
uris: https://download.docker.com/linux/debian uris: https://download.docker.com/linux/debian
suites: "{{ ansible_distribution_release }}" suites: "{{ ansible_facts['distribution_release'] }}"
components: components:
- stable - stable
signed_by: |- signed_by: |-

View file

@ -4,17 +4,17 @@
tags: always tags: always
with_first_found: with_first_found:
- files: - files:
- "vars/{{ ansible_distribution }}.yaml" - "vars/{{ ansible_facts['distribution'] }}.yaml"
skip: true skip: true
- name: Ensure dependencies for docker module are installed - name: Ensure dependencies for docker module are installed
block: block:
- name: Ensure debian hosts are properly configured - name: Ensure debian hosts are properly configured
ansible.builtin.import_tasks: ./debian.yaml ansible.builtin.import_tasks: ./debian.yaml
when: ansible_distribution in debian_derivatives when: ansible_facts["distribution"] in debian_derivatives
- name: Ensure alpine hosts are properly configured - name: Ensure alpine hosts are properly configured
ansible.builtin.import_tasks: ./alpine.yaml ansible.builtin.import_tasks: ./alpine.yaml
when: ansible_distribution == 'Alpine' when: ansible_facts["distribution"] == 'Alpine'
rescue: rescue:
- name: Set that this task failed - name: Set that this task failed

View file

@ -5,5 +5,6 @@ debian_derivatives:
- "Pop!_OS" - "Pop!_OS"
- "Ubuntu" - "Ubuntu"
global_dns_servers: global_dns_servers:
- 10.69.11.4 - 10.69.2.4
- 10.69.9.11
# code: language=ansible # code: language=ansible

View file

@ -0,0 +1,2 @@
---
server_name: adguardpi

View file

@ -2,25 +2,27 @@
all: all:
hosts: hosts:
adguard: adguard:
ansible_host: 10.69.11.4 ansible_host: 10.69.2.4
maxim: adguardpi:
ansible_host: 10.69.10.50 ansible_host: 10.69.9.12
pump: # maxim:
ansible_host: 10.69.10.51 # ansible_host: 10.69.10.50
fifi: # pump:
ansible_host: 10.69.10.52 # ansible_host: 10.69.10.51
knivi: # fifi:
ansible_host: 10.69.10.53 # ansible_host: 10.69.10.52
# knivi:
# ansible_host: 10.69.1.50
reir: reir:
ansible_host: 10.69.10.54 ansible_host: 10.69.9.11
trady: trady:
ansible_host: 10.69.11.11 ansible_host: 10.69.2.11
stephanie: stephanie:
ansible_host: 10.69.11.51 ansible_host: 10.69.2.51
nemetona: nemetona:
ansible_host: 10.69.11.52 ansible_host: 10.69.2.52
ida: ida:
ansible_host: 10.69.11.53 ansible_host: 10.69.2.53
children: children:
alpine: alpine:
hosts: hosts:
@ -30,23 +32,29 @@ all:
ida: ida:
debian: debian:
hosts: hosts:
maxim: adguardpi:
pump: # maxim:
fifi: # pump:
knivi: # fifi:
# knivi:
reir: reir:
trady: # trady:
docker: docker:
hosts: hosts:
adguard: adguard:
pump: adguardpi:
trady: # pump:
# trady:
stephanie: stephanie:
nemetona: nemetona:
unifi_controller: unifi_controller:
hosts: hosts:
pump: # pump:
adguard_servers: adguard_servers:
hosts:
adguard:
adguardpi:
adguard_sync:
hosts: hosts:
adguard: adguard:
coder: coder:

View file

@ -9,13 +9,13 @@
tags: always tags: always
community.general.apk: community.general.apk:
update_cache: true update_cache: true
when: ansible_distribution == "Alpine" when: ansible_facts["distribution"] == "Alpine"
- name: Update package cache (Debian, and derivatives) - name: Update package cache (Debian, and derivatives)
tags: always tags: always
ansible.builtin.apt: ansible.builtin.apt:
update_cache: true update_cache: true
changed_when: false changed_when: false
when: ansible_distribution in debian_derivatives when: ansible_facts["distribution"] in debian_derivatives
- name: Common tasks for all hosts - name: Common tasks for all hosts
hosts: all hosts: all
@ -30,11 +30,17 @@
roles: roles:
- adhdgirl.minilab.docker - adhdgirl.minilab.docker
- name: Configure AdGuard home hosts - name: Configure AdGuard home hosts
hosts: pump hosts: adguard_servers
tags: docker,adguard tags: docker,adguard
become: true become: true
roles: roles:
- adhdgirl.minilab.adguardhome - adhdgirl.minilab.adguardhome
- name: Configure AdguardHome-Sync hosts
hosts: adguard_sync
tags: docker,adguard
become: true
roles:
- adhdgirl.minilab.adguardhome_sync
- name: Configure Coder hosts - name: Configure Coder hosts
hosts: coder hosts: coder
tags: docker,coder tags: docker,coder