Initial Ansible automation for hobbs.farm infrastructure
Complete IaC covering: - 14 roles: common, docker, traefik, vaultwarden, monitoring, media, matrix, home_assistant, frigate, adguard, gitea, semaphore, openclaw, security, backup - Inventory for all hosts (Peggy, Bart, Yoda, NAS, Firewalla) - Stack playbooks: core-infrastructure, monitoring, media, communication, automation, smarthome, security-hardening - Maintenance playbooks: update-containers, backup, health-check - Production Docker Compose templates with Traefik labels - Security hardening (sysctl, auditd, UFW, fail2ban) - Automated backups with retention policy
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
---
|
||||
media_compose_dir: "{{ docker_compose_base }}/media"
|
||||
jellyfin_data_dir: /data/jellyfin
|
||||
sonarr_data_dir: /data/sonarr
|
||||
radarr_data_dir: /data/radarr
|
||||
sabnzbd_data_dir: /data/sabnzbd
|
||||
nzbhydra_data_dir: /data/nzbhydra2
|
||||
jellyseerr_data_dir: /data/jellyseerr
|
||||
|
||||
jellyfin_image: "jellyfin/jellyfin:latest"
|
||||
sonarr_image: "lscr.io/linuxserver/sonarr:latest"
|
||||
radarr_image: "lscr.io/linuxserver/radarr:latest"
|
||||
sabnzbd_image: "lscr.io/linuxserver/sabnzbd:latest"
|
||||
nzbhydra_image: "lscr.io/linuxserver/nzbhydra2:latest"
|
||||
jellyseerr_image: "fallenbagel/jellyseerr:latest"
|
||||
|
||||
media_path: /mnt/nas/media
|
||||
downloads_path: /mnt/nas/downloads
|
||||
|
||||
jellyfin_host: "jellyfin.{{ domain }}"
|
||||
sonarr_host: "sonarr.{{ domain }}"
|
||||
radarr_host: "radarr.{{ domain }}"
|
||||
sabnzbd_host: "sabnzbd.{{ domain }}"
|
||||
jellyseerr_host: "jellyseerr.{{ domain }}"
|
||||
|
||||
puid: "1000"
|
||||
pgid: "1000"
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
- name: Create media directories
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: glyptic
|
||||
group: docker
|
||||
mode: "0755"
|
||||
loop:
|
||||
- "{{ media_compose_dir }}"
|
||||
- "{{ jellyfin_data_dir }}"
|
||||
- "{{ sonarr_data_dir }}"
|
||||
- "{{ radarr_data_dir }}"
|
||||
- "{{ sabnzbd_data_dir }}"
|
||||
- "{{ nzbhydra_data_dir }}"
|
||||
- "{{ jellyseerr_data_dir }}"
|
||||
tags: [media]
|
||||
|
||||
- name: Deploy media compose file
|
||||
ansible.builtin.template:
|
||||
src: docker-compose.yml.j2
|
||||
dest: "{{ media_compose_dir }}/docker-compose.yml"
|
||||
owner: glyptic
|
||||
group: docker
|
||||
mode: "0644"
|
||||
tags: [media]
|
||||
|
||||
- name: Start media stack
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ media_compose_dir }}"
|
||||
state: present
|
||||
tags: [media]
|
||||
@@ -0,0 +1,116 @@
|
||||
services:
|
||||
jellyfin:
|
||||
image: {{ jellyfin_image }}
|
||||
container_name: jellyfin
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
JELLYFIN_PublishedServerUrl: "https://{{ jellyfin_host }}"
|
||||
volumes:
|
||||
- {{ jellyfin_data_dir }}/config:/config
|
||||
- {{ jellyfin_data_dir }}/cache:/cache
|
||||
- {{ media_path }}:/media
|
||||
labels:
|
||||
traefik.enable: "true"
|
||||
traefik.http.routers.jellyfin.rule: "Host(`{{ jellyfin_host }}`)"
|
||||
traefik.http.routers.jellyfin.entrypoints: websecure
|
||||
traefik.http.routers.jellyfin.tls.certresolver: cloudflare
|
||||
traefik.http.services.jellyfin.loadbalancer.server.port: "8096"
|
||||
networks:
|
||||
- {{ docker_network_name }}
|
||||
|
||||
sonarr:
|
||||
image: {{ sonarr_image }}
|
||||
container_name: sonarr
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
PUID: "{{ puid }}"
|
||||
PGID: "{{ pgid }}"
|
||||
TZ: {{ timezone }}
|
||||
volumes:
|
||||
- {{ sonarr_data_dir }}:/config
|
||||
- {{ media_path }}/tv:/tv
|
||||
- {{ downloads_path }}:/downloads
|
||||
labels:
|
||||
traefik.enable: "true"
|
||||
traefik.http.routers.sonarr.rule: "Host(`{{ sonarr_host }}`)"
|
||||
traefik.http.routers.sonarr.entrypoints: websecure
|
||||
traefik.http.routers.sonarr.tls.certresolver: cloudflare
|
||||
traefik.http.services.sonarr.loadbalancer.server.port: "8989"
|
||||
networks:
|
||||
- {{ docker_network_name }}
|
||||
|
||||
radarr:
|
||||
image: {{ radarr_image }}
|
||||
container_name: radarr
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
PUID: "{{ puid }}"
|
||||
PGID: "{{ pgid }}"
|
||||
TZ: {{ timezone }}
|
||||
volumes:
|
||||
- {{ radarr_data_dir }}:/config
|
||||
- {{ media_path }}/movies:/movies
|
||||
- {{ downloads_path }}:/downloads
|
||||
labels:
|
||||
traefik.enable: "true"
|
||||
traefik.http.routers.radarr.rule: "Host(`{{ radarr_host }}`)"
|
||||
traefik.http.routers.radarr.entrypoints: websecure
|
||||
traefik.http.routers.radarr.tls.certresolver: cloudflare
|
||||
traefik.http.services.radarr.loadbalancer.server.port: "7878"
|
||||
networks:
|
||||
- {{ docker_network_name }}
|
||||
|
||||
sabnzbd:
|
||||
image: {{ sabnzbd_image }}
|
||||
container_name: sabnzbd
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
PUID: "{{ puid }}"
|
||||
PGID: "{{ pgid }}"
|
||||
TZ: {{ timezone }}
|
||||
volumes:
|
||||
- {{ sabnzbd_data_dir }}:/config
|
||||
- {{ downloads_path }}:/downloads
|
||||
labels:
|
||||
traefik.enable: "true"
|
||||
traefik.http.routers.sabnzbd.rule: "Host(`{{ sabnzbd_host }}`)"
|
||||
traefik.http.routers.sabnzbd.entrypoints: websecure
|
||||
traefik.http.routers.sabnzbd.tls.certresolver: cloudflare
|
||||
traefik.http.services.sabnzbd.loadbalancer.server.port: "8080"
|
||||
networks:
|
||||
- {{ docker_network_name }}
|
||||
|
||||
nzbhydra2:
|
||||
image: {{ nzbhydra_image }}
|
||||
container_name: nzbhydra2
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
PUID: "{{ puid }}"
|
||||
PGID: "{{ pgid }}"
|
||||
TZ: {{ timezone }}
|
||||
volumes:
|
||||
- {{ nzbhydra_data_dir }}:/config
|
||||
- {{ downloads_path }}:/downloads
|
||||
networks:
|
||||
- {{ docker_network_name }}
|
||||
|
||||
jellyseerr:
|
||||
image: {{ jellyseerr_image }}
|
||||
container_name: jellyseerr
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
TZ: {{ timezone }}
|
||||
volumes:
|
||||
- {{ jellyseerr_data_dir }}:/app/config
|
||||
labels:
|
||||
traefik.enable: "true"
|
||||
traefik.http.routers.jellyseerr.rule: "Host(`{{ jellyseerr_host }}`)"
|
||||
traefik.http.routers.jellyseerr.entrypoints: websecure
|
||||
traefik.http.routers.jellyseerr.tls.certresolver: cloudflare
|
||||
traefik.http.services.jellyseerr.loadbalancer.server.port: "5055"
|
||||
networks:
|
||||
- {{ docker_network_name }}
|
||||
|
||||
networks:
|
||||
{{ docker_network_name }}:
|
||||
external: true
|
||||
Reference in New Issue
Block a user