Start refactoring to new structure

This commit is contained in:
Javier Feliz 2025-07-03 22:03:13 -04:00
parent fe940fe107
commit b79c1563d5
10 changed files with 96 additions and 23 deletions

View File

@ -1,3 +1,5 @@
[defaults]
inventory = hosts.yml
roles_path = ./roles
vault_password_file = ~/.homelab-ansible-vault-pass
vars_files="group_vars/secrets.yml"

7
group_vars/vms.yml Normal file
View File

@ -0,0 +1,7 @@
$ANSIBLE_VAULT;1.1;AES256
66666232393236366535336639396266366131643930323662376334333138363266633431656263
6266363861373237346231343334623565386138393737390a623932363063306437383466303564
35616132383361353036663839643763363762623534653732323864636462346635363366623533
6536376161333663300a643939303465326133366463383234356535626465623162303836373664
65373562363134653633363335326536353062373734373066393862363139376435303833393836
3664646663646534323938393762373535666332386164353631

View File

@ -1,23 +0,0 @@
---
- name: Deploy Kan.bn app
hosts: apps
become: true
roles:
- role: app/database
vars:
app_name: kan
tasks:
- name: Create kan-web container with correct ports
community.docker.docker_container:
name: kan-web
image: ghcr.io/kanbn/kan:latest
pull: true
state: started
restart_policy: unless-stopped
ports:
- "7070:3000"
env:
NEXT_PUBLIC_BASE_URL: "https://tasks.thegrind.dev"
BETTER_AUTH_SECRET: "your_auth_secret"
POSTGRES_URL: "postgresql://kan:password@10.89.0.102:5432/kan"
NEXT_PUBLIC_ALLOW_CREDENTIALS: "true"

14
playbooks/nodes/apps.yml Normal file
View File

@ -0,0 +1,14 @@
---
- name: Deploy apps to apps-1 node
hosts: apps
become: true
roles:
- role: apps/kan
vars:
port: 7070
- role: apps/memos
vars:
port: 7071
- role: apps/vaultwarden
vars:
port: 7072

View File

View File

@ -0,0 +1,20 @@
- name: Create app DB
ansible.builtin.include_role:
name: app/database
vars:
app_name: kan
- name: Create kan-web container
community.docker.docker_container:
name: kan-web
image: ghcr.io/kanbn/kan:latest
pull: true
state: started
restart_policy: unless-stopped
ports:
- "{{ port }}:3000"
env:
NEXT_PUBLIC_BASE_URL: "https://tasks.thegrind.dev"
BETTER_AUTH_SECRET: "your_auth_secret"
POSTGRES_URL: "postgresql://kan:password@10.89.0.102:5432/kan"
NEXT_PUBLIC_ALLOW_CREDENTIALS: "true"

View File

View File

@ -0,0 +1,18 @@
- name: Create app DB
ansible.builtin.include_role:
name: app/database
vars:
app_name: memos
- name: Deploy memos container
community.docker.docker_container:
name: memos
image: neosmemo/memos:stable
pull: true
state: started
restart_policy: unless-stopped
ports:
- "{{ port }}:5230"
env:
MEMOS_DRIVER: "postgres"
MEMOS_DSN: "user=memos password=password dbname=memos host=10.89.0.102 sslmode=disable"

View File

View File

@ -0,0 +1,35 @@
- name: Create the data directory
ansible.builtin.file:
path: "/home/docker/container-data"
state: directory
mode: '0777'
become: true
- name: Mount the data share to the VM
ansible.builtin.include_tasks:
file: ../tasks/mount_nfs.yml
vars:
mount_path: "/home/docker/container-data"
mount_source: "10.89.0.15:/mnt/main/container-data"
- name: Create the data directory
ansible.builtin.file:
path: "/home/docker/container-data/vaultwarden-data"
state: directory
mode: '0777'
become: true
- name: Create vaultwarden container
community.docker.docker_container:
name: vaultwarden
image: vaultwarden/server:latest
pull: true
state: started
restart_policy: always
ports:
- "{{ port }}:80"
env:
DOMAIN: "https://vaultwarden.blinker.club"
ADMIN_TOKEN: "{{ vaultwarden_admin_token }}"
volumes:
- /home/docker/container-data/vaultwarden-data/:/data/