Rework repo - move files around and update play

Updating repo and files to look a bit more on par with the style of
ansible I'm used to writing. Removing inventory as it can easily go
stale and the homelab env needs to be a bit more dynamic anyway. need to
find a good way to manage this but for now, no inventory is better than
outdated inv.
This commit is contained in:
Zach Wayer
2024-07-04 22:43:34 -05:00
parent 5d4f177c6b
commit 8f1c29b847
3 changed files with 53 additions and 52 deletions

View File

@@ -1,6 +1,6 @@
--- ---
version: '3.4' version: '3.4'
x-function: &function x-function: &traefik-config
networks: networks:
- traefik_proxy1 - traefik_proxy1
labels: labels:
@@ -23,9 +23,8 @@ x-function: &function
# Media Server # Media Server
services: services:
# Grabber, manage TV shows # Grabber, manage TV shows
sonarr: sonarr:
<<: *function <<: *traefik-config
image: linuxserver/sonarr:latest image: linuxserver/sonarr:latest
container_name: sonarr container_name: sonarr
volumes: volumes:
@@ -43,7 +42,7 @@ services:
# Indexer, Used by managers to query sites for content # Indexer, Used by managers to query sites for content
jackett: jackett:
<<: *function <<: *traefik-config
image: linuxserver/jackett:latest image: linuxserver/jackett:latest
container_name: jackett container_name: jackett
volumes: volumes:
@@ -58,7 +57,7 @@ services:
- "docker.group=internal" - "docker.group=internal"
# Reverse Proxy, Used to route applications to domain # Reverse Proxy, Used to route applications to domain
traefik: traefik:
<<: *function <<: *traefik-config
hostname: traefik hostname: traefik
image: traefik:v1.7 image: traefik:v1.7
container_name: traefik container_name: traefik
@@ -85,7 +84,7 @@ services:
- /opt/appdata/traefik/tmp:/tmp - /opt/appdata/traefik/tmp:/tmp
# Downloader, pull in content from torrents & hide traffic behind VPN # Downloader, pull in content from torrents & hide traffic behind VPN
arch-deluge: arch-deluge:
<<: *function <<: *traefik-config
image: binhex/arch-delugevpn:latest image: binhex/arch-delugevpn:latest
container_name: arch-deluge container_name: arch-deluge
ports: ports:
@@ -123,9 +122,9 @@ services:
- "traefik.port=8112" - "traefik.port=8112"
- "docker.group=external" - "docker.group=external"
privileged: true privileged: true
#updated version of plex requests # User Request, auto add to searchers
ombi: ombi:
<<: *function <<: *traefik-config
image: linuxserver/ombi image: linuxserver/ombi
container_name: ombi container_name: ombi
environment: environment:
@@ -148,7 +147,7 @@ services:
- 3579:3579 - 3579:3579
# NZBGet - usenet downloader # NZBGet - usenet downloader
nzbget: nzbget:
<<: *function <<: *traefik-config
image: linuxserver/nzbget:latest image: linuxserver/nzbget:latest
container_name: nzbget container_name: nzbget
volumes: volumes:
@@ -168,7 +167,5 @@ services:
# Networks, Needed for Traefik # Networks, Needed for Traefik
networks: networks:
traefik_proxy1: traefik_proxy1:
# external: true
default: default:
driver: bridge driver: bridge

View File

@@ -1,6 +0,0 @@
---
all:
hosts:
tower:
ansible_host: 192.168.0.62
vars:

View File

@@ -1,11 +1,15 @@
- hosts: all ---
- name: Install and setup Server for media acqusition
hosts: all
become: true become: true
become_user: root
vars: vars:
pip_install_packages: pip_install_packages:
- name: Docker - name: Docker
nfs_host: 192.168.0.109 nfs_host: 192.168.0.109
nfs_options: "auto,nofail,noatime,nolock,intr,tcp,actimeo=1800" nfs_options:
"auto,nofail,noatime,nolock,intr,tcp,actimeo=1800,x-systemd.automount"
nfs_mounts: nfs_mounts:
- remote_path: /export/Movies - remote_path: /export/Movies
local_path: /mnt/storage/movies local_path: /mnt/storage/movies
@@ -18,7 +22,7 @@
- geerlingguy.pip - geerlingguy.pip
- geerlingguy.docker - geerlingguy.docker
tasks: tasks:
- name: Install docker tools - name: Install system packages
ansible.builtin.package: ansible.builtin.package:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
@@ -54,24 +58,30 @@
shell: "{{ item.shell }}" shell: "{{ item.shell }}"
groups: "{{ item.groups }}" groups: "{{ item.groups }}"
loop: loop:
- { user: "zware", shell: "/bin/zsh", groups: "sudo,docker" } - {user: "dockeruser",
- { user: "dockeruser", shell: "/bin/bash", groups: "docker" } shell: "/bin/bash",
groups: "docker"}
# zware user should already exist when this is run,
# most likely needs ot happen in a cloud init step
# - {user: "zware",
# shell: "/bin/zsh",
# groups: "sudo,docker"}
- name: Copy docker-compose - name: Copy docker-compose
ansible.builtin.copy: ansible.builtin.copy:
src: docker-compose.yml src: "{{ item.src }}"
dest: /opt/docker-compose.yml dest: "{{ item.dest }}"
owner: root owner: dockeruser
group: root group: dockeruser
mode: "0644" mode: "{{ item.mode }}"
backup: true
- name: Copy env file loop:
ansible.builtin.copy: - {src: "files/docker-compose.yaml",
src: environment dest: "/opt/docker-compose.yaml",
dest: /opt/environment mode: "0644"}
owner: zware - {src: "files/environmnet",
group: zware dest: "/opt/.env",
mode: "0600" mode: "0600"}
- name: Start containers - name: Start containers
community.docker.docker_compose: community.docker.docker_compose: