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,43 @@
|
||||
---
|
||||
- name: Ensure backup destination directory exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ backup_destination }}"
|
||||
state: directory
|
||||
owner: glyptic
|
||||
group: glyptic
|
||||
mode: "0750"
|
||||
tags: [backup]
|
||||
|
||||
- name: Deploy backup script
|
||||
ansible.builtin.template:
|
||||
src: backup.sh.j2
|
||||
dest: "{{ backup_script_path }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0750"
|
||||
tags: [backup]
|
||||
|
||||
- name: Configure backup cron job
|
||||
ansible.builtin.cron:
|
||||
name: "homelab-backup"
|
||||
minute: "0"
|
||||
hour: "2"
|
||||
job: "{{ backup_script_path }} >> /var/log/homelab-backup.log 2>&1"
|
||||
user: root
|
||||
tags: [backup]
|
||||
|
||||
- name: Configure backup log rotation
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
/var/log/homelab-backup.log {
|
||||
weekly
|
||||
rotate 4
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
}
|
||||
dest: /etc/logrotate.d/homelab-backup
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
tags: [backup]
|
||||
Reference in New Issue
Block a user