This commit is contained in:
Javier Feliz 2025-03-25 12:51:36 -04:00
parent 92d5357c2c
commit c838e19c84
7 changed files with 99 additions and 165 deletions

View File

@ -5,22 +5,16 @@ all:
hosts: hosts:
node1: node1:
ansible_host: 10.89.0.13 ansible_host: 10.89.0.13
node2:
ansible_host: 10.89.0.11
node3: node3:
ansible_host: 10.89.0.12 ansible_host: 10.89.0.12
nas: nas:
ansible_host: 10.89.0.15 ansible_host: 10.89.0.15
virtual_machines: vms:
hosts: hosts:
portainer_main: portainer_main:
ansible_host: 10.89.0.101 ansible_host: 10.89.0.101
prod_services: prod_services:
ansible_host: 11.89.0.102 ansible_host: 10.89.0.102
stash:
ansible_host: 10.89.0.103
plane_so:
ansible_host: 10.89.0.104
dev_services: dev_services:
ansible_host: 10.89.0.105 ansible_host: 10.89.0.105
streaming_services: streaming_services:

View File

@ -3,106 +3,105 @@
hosts: streaming hosts: streaming
vars: vars:
apps: apps:
- sonarr - sonarr
configs: configs:
- src: '../assets/arrstack/sonarr/config.xml' - src: '../assets/arrstack/sonarr/config.xml'
dest: '/home/docker/sonarr/config.xml' dest: '/home/docker/sonarr/config.xml'
- src: '../assets/arrstack/prowlarr/config.xml' - src: '../assets/arrstack/prowlarr/config.xml'
dest: '/home/docker/prowlarr/config.xml' dest: '/home/docker/prowlarr/config.xml'
- src: '../assets/arrstack/radarr/config.xml' - src: '../assets/arrstack/radarr/config.xml'
dest: '/home/docker/radarr/config.xml' dest: '/home/docker/radarr/config.xml'
- src: '../assets/arrstack/readarr/config.xml' - src: '../assets/arrstack/readarr/config.xml'
dest: '/home/docker/readarr/config.xml' dest: '/home/docker/readarr/config.xml'
- src: '../assets/arrstack/qbittorrent/qBittorrent.conf' - src: '../assets/arrstack/qbittorrent/qBittorrent.conf'
dest: '/home/docker/qbittorrent/qBittorrent.conf' dest: '/home/docker/qbittorrent/qBittorrent.conf'
dbs: dbs:
- arrstack_sonarr_main - arrstack_sonarr_main
- arrstack_sonarr_log - arrstack_sonarr_log
- arrstack_radarr_main - arrstack_radarr_main
- arrstack_radarr_log - arrstack_radarr_log
- arrstack_prowlarr_main - arrstack_prowlarr_main
- arrstack_prowlarr_log - arrstack_prowlarr_log
- arrstack_readarr_main - arrstack_readarr_main
- arrstack_readarr_log - arrstack_readarr_log
- arrstack_readarr_cache - arrstack_readarr_cache
tasks: tasks:
- name: Mount the media share to the VM - name: Mount the media share to the VM
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: ../tasks/mount_nfs.yml file: ../tasks/mount_nfs.yml
vars: vars:
mount_path: "/home/docker/media" mount_path: "/home/docker/media"
mount_source: "10.89.0.15:/mnt/main/media" mount_source: "10.89.0.15:/mnt/main/media"
- name: Create arrstack user on postgres - name: Create arrstack user on postgres
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: '../tasks/postgres/create_user.yml' file: '../tasks/postgres/create_user.yml'
vars: vars:
user: arrstack user: arrstack
password: password password: password
- name: Create app databases on postgres - name: Create app databases on postgres
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: '../tasks/postgres/create_database.yml' file: '../tasks/postgres/create_database.yml'
vars: vars:
database: "{{ item }}" database: "{{ item }}"
loop: "{{ dbs }}" loop: "{{ dbs }}"
- name: Give the arrstack user full privs on the databases - name: Give the arrstack user full privs on the databases
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: '../tasks/postgres/give_user_full_privs.yml' file: '../tasks/postgres/give_user_full_privs.yml'
vars: vars:
user: arrstack user: arrstack
database: "{{ item }}" database: "{{ item }}"
loop: "{{ dbs }}" loop: "{{ dbs }}"
- name: Ensure config directories exist - name: Ensure config directories exist
ansible.builtin.file: ansible.builtin.file:
path: "{{ item.dest | dirname }}" path: "{{ item.dest | dirname }}"
state: directory state: directory
mode: '0777' mode: '0777'
become: true become: true
loop: "{{ configs }}" loop: "{{ configs }}"
- name: Copy configuration files - name: Copy configuration files
ansible.builtin.copy: ansible.builtin.copy:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
owner: javi owner: javi
group: javi group: javi
mode: '0777' mode: '0777'
loop: "{{ configs }}" loop: "{{ configs }}"
- name: Ensure docker compose folder exists - name: Ensure docker compose folder exists
ansible.builtin.file: ansible.builtin.file:
path: /home/javi/docker/arrstack path: /home/javi/docker/arrstack
state: directory state: directory
mode: '0777' mode: '0777'
become: true become: true
- name: Copy docker-compose.yml to server - name: Copy docker-compose.yml to server
ansible.builtin.copy: ansible.builtin.copy:
src: '../docker/arrstack/docker-compose.yml' src: '../docker/arrstack/docker-compose.yml'
dest: '/home/javi/docker/arrstack/docker-compose.yml' dest: '/home/javi/docker/arrstack/docker-compose.yml'
owner: javi owner: javi
group: javi group: javi
mode: '0777' mode: '0777'
- name: Copy docker .env to server - name: Copy docker .env to server
ansible.builtin.copy: ansible.builtin.copy:
src: '../docker/arrstack/.env' src: '../docker/arrstack/.env'
dest: '/home/javi/docker/arrstack/.env' dest: '/home/javi/docker/arrstack/.env'
owner: javi owner: javi
group: javi group: javi
mode: '0777' mode: '0777'
- name: Start up the containers - name: Start up the containers
ansible.builtin.command: docker compose up -d ansible.builtin.command: docker compose up -d
args: args:
chdir: /home/javi/docker/arrstack chdir: /home/javi/docker/arrstack
become: true become: true
# - name: Restart just in case
# - name: Restart just in case # ansible.builtin.command: docker compose restart
# ansible.builtin.command: docker compose restart # args:
# args: # chdir: /home/javi/docker/arrstack
# chdir: /home/javi/docker/arrstack # become: true
# become: true

View File

@ -1,10 +0,0 @@
---
- name: Distribute SSH public key to my hosts
hosts: all
become: true
tasks:
- name: Add SSH key for remote user
ansible.posix.authorized_key:
user: javi
state: present
key: "{{ lookup('file', '/home/javi/.ssh/homelab_keypair_ed25519.pub') }}"

View File

@ -1,6 +1,6 @@
--- ---
- name: Set up a new virtual machine - name: Set up a new virtual machine
hosts: all hosts: vms
become: true become: true
roles: roles:
- role: docker/install - role: docker/install

View File

@ -1,16 +0,0 @@
---
- name: Create standardized admin on all hosts
hosts: virtual_machines
become: true
vars:
username: serveradmin
password: "Cinnamonbun89$"
tasks:
- name: Create the standard user on the host
ansible.builtin.user:
name: "{{ username }}"
state: present
shell: /bin/bash
create_home: true
groups: sudo
append: true

View File

@ -1,39 +0,0 @@
---
- name: Set up wizarr
hosts: streaming_services
become: true
tasks:
- name: Create app DB
ansible.builtin.include_tasks:
file: '../tasks/create_app_db.yml'
vars:
app: wizarr
- name: Make sure UUID PG extension is installed
ansible.builtin.include_tasks:
file: '../tasks/postgres/install_extension.yml'
vars:
extension: uuid-ossp
database: wizarr
- name: Ensure config directories exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0777'
loop:
- '/home/docker/wizarr'
- '/home/javi/docker/wizarr'
- name: Copy docker-compose.yml to server
ansible.builtin.copy:
src: '../docker/wizarr/docker-compose.yml'
dest: '/home/javi/docker/wizarr/docker-compose.yml'
owner: javi
group: javi
mode: '0777'
- name: Start up the containers
ansible.builtin.command: docker compose up -d
args:
chdir: /home/javi/docker/wizarr

View File

@ -0,0 +1,6 @@
---
- name: Add SSH key for remote user
ansible.posix.authorized_key:
user: javi
state: present
key: "{{ lookup('file', '/home/javi/.ssh/homelab_keypair_ed25519.pub') }}"