1 Commits
Author SHA1 Message Date
alessandrovitali 5b22e7e784 Merge branch 'main' into feat/backup 2026-09-03 16:30:08 +02:00
4 changed files with 16 additions and 20 deletions

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
# Ansible Collection
Opinionated set of roles to configure reasonable defaults for newly provisioned virtual machines. The repository provides a ready-to-use Ansible Collection (`studiovitali.ansible`) containing reusable roles.
Opinionated set of roles to configure reasonable defaults for newly provisioned virtual machines. The repository provides a ready-to-use Ansible Collection (`studio.ansible`) containing reusable roles.
Currently only supports Debian-based systems.
+1 -1
View File
@@ -1,6 +1,6 @@
## galaxy.yml
namespace: studiovitali
namespace: studio
name: ansible
readme: README.md
version: 0.0.1
+9 -17
View File
@@ -1,31 +1,26 @@
---
- name: Install and initialize restic
become: true
- name: Install restic
ansible.builtin.apt:
name: restic
state: present
- name: Initialize restic repository
environment:
RESTIC_REPOSITORY: "{{ vault_restic_repo_url }}"
RESTIC_PASSWORD: "{{ vault_restic_password }}"
AWS_ACCESS_KEY_ID: "{{ vault_aws_access_key }}"
AWS_SECRET_ACCESS_KEY: "{{ vault_aws_secret_key }}"
block:
- name: Install restic
ansible.builtin.apt:
name: restic
state: present
update_cache: true
- name: Check if repository is initialized
ansible.builtin.command: restic cat config
- name: Check if already initialized
ansible.builtin.command: restic snapshots
register: restic_check
changed_when: false
failed_when: false
changed_when: false
- name: Initialize repository
ansible.builtin.command: restic init
when: restic_check.rc != 0
- name: Configure restic backup job
become: true
block:
- name: Deploy restic environment file
ansible.builtin.template:
src: restic-backup.env.j2
@@ -42,9 +37,6 @@
group: root
mode: "0700" ## only root can execute the script
- name: Schedule restic backups
become: true
block:
- name: Deploy restic systemd service
ansible.builtin.template:
src: restic-backup.service.j2
+5 -1
View File
@@ -3,7 +3,11 @@
set -e
## Environment is injected by the systemd unit via EnvironmentFile=/etc/restic-backup.env. Run manually with: systemctl start restic-backup.service
# Source environment variables if running manually/outside Systemd
if [ -f /etc/restic-backup.env ]; then
# shellcheck source=/dev/null
. /etc/restic-backup.env
fi
echo "Starting Restic Backup at $(date)"