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:
2026-02-01 23:14:46 -06:00
parent 02beae23a0
commit b9be45dc71
74 changed files with 2110 additions and 2 deletions
+42
View File
@@ -0,0 +1,42 @@
---
- name: Run backups
hosts: docker_hosts
become: true
tasks:
- name: Ensure backup destination exists
ansible.builtin.file:
path: "{{ backup_destination }}"
state: directory
mode: "0750"
tags: [backup]
- name: Run backup script
ansible.builtin.command:
cmd: /usr/local/bin/homelab-backup.sh
register: backup_result
changed_when: backup_result.rc == 0
tags: [backup]
- name: Display backup result
ansible.builtin.debug:
msg: "{{ backup_result.stdout_lines }}"
tags: [backup]
- name: Clean up backups older than 30 days
ansible.builtin.find:
paths: "{{ backup_destination }}"
age: 30d
recurse: false
file_type: file
patterns: "*.tar.gz"
register: old_backups
tags: [backup, cleanup]
- name: Remove old backups
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
loop: "{{ old_backups.files }}"
loop_control:
label: "{{ item.path | basename }}"
tags: [backup, cleanup]