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,8 @@
|
||||
---
|
||||
gitea_compose_dir: "{{ docker_compose_base }}/automation"
|
||||
gitea_data_dir: /data/gitea
|
||||
gitea_image: "gitea/gitea:latest"
|
||||
gitea_db_image: "postgres:16-alpine"
|
||||
gitea_host: "git.{{ domain }}"
|
||||
gitea_ssh_port: 2222
|
||||
gitea_db_password: "{{ vault_gitea_db_password }}"
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: Create Gitea directories
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: glyptic
|
||||
group: docker
|
||||
mode: "0755"
|
||||
loop:
|
||||
- "{{ gitea_compose_dir }}"
|
||||
- "{{ gitea_data_dir }}"
|
||||
- "{{ gitea_data_dir }}/db"
|
||||
tags: [gitea, automation]
|
||||
|
||||
- name: Deploy Gitea compose file
|
||||
ansible.builtin.template:
|
||||
src: docker-compose.yml.j2
|
||||
dest: "{{ gitea_compose_dir }}/docker-compose.yml"
|
||||
owner: glyptic
|
||||
group: docker
|
||||
mode: "0644"
|
||||
tags: [gitea, automation]
|
||||
|
||||
- name: Start Gitea stack
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ gitea_compose_dir }}"
|
||||
state: present
|
||||
tags: [gitea, automation]
|
||||
@@ -0,0 +1,50 @@
|
||||
services:
|
||||
gitea:
|
||||
image: {{ gitea_image }}
|
||||
container_name: gitea
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
USER_UID: "1000"
|
||||
USER_GID: "1000"
|
||||
GITEA__database__DB_TYPE: postgres
|
||||
GITEA__database__HOST: gitea-db:5432
|
||||
GITEA__database__NAME: gitea
|
||||
GITEA__database__USER: gitea
|
||||
GITEA__database__PASSWD: {{ gitea_db_password }}
|
||||
GITEA__server__DOMAIN: {{ gitea_host }}
|
||||
GITEA__server__SSH_DOMAIN: {{ gitea_host }}
|
||||
GITEA__server__SSH_PORT: {{ gitea_ssh_port }}
|
||||
GITEA__server__ROOT_URL: "https://{{ gitea_host }}/"
|
||||
volumes:
|
||||
- {{ gitea_data_dir }}:/data
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
ports:
|
||||
- "{{ gitea_ssh_port }}:22"
|
||||
depends_on:
|
||||
- gitea-db
|
||||
labels:
|
||||
traefik.enable: "true"
|
||||
traefik.http.routers.gitea.rule: "Host(`{{ gitea_host }}`)"
|
||||
traefik.http.routers.gitea.entrypoints: websecure
|
||||
traefik.http.routers.gitea.tls.certresolver: cloudflare
|
||||
traefik.http.services.gitea.loadbalancer.server.port: "3000"
|
||||
networks:
|
||||
- {{ docker_network_name }}
|
||||
|
||||
gitea-db:
|
||||
image: {{ gitea_db_image }}
|
||||
container_name: gitea-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: gitea
|
||||
POSTGRES_PASSWORD: {{ gitea_db_password }}
|
||||
POSTGRES_DB: gitea
|
||||
volumes:
|
||||
- {{ gitea_data_dir }}/db:/var/lib/postgresql/data
|
||||
networks:
|
||||
- {{ docker_network_name }}
|
||||
|
||||
networks:
|
||||
{{ docker_network_name }}:
|
||||
external: true
|
||||
Reference in New Issue
Block a user