Author SHA1 Message Date
alessandrovitali 2b5570ce48 add role metadata 2026-09-03 16:17:20 +02:00
10 changed files with 35 additions and 134 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
-14
View File
@@ -1,14 +0,0 @@
# ansible/roles/backup/defaults/main.yml
---
## Directories to include in the backup
backup_include_paths:
- /etc
- /opt/docker
## Directories to exclude from the backup
backup_exclude_paths: [] ## Nothing to exclude
## Restic retention policy
backup_retention_daily: 7
backup_retention_weekly: 4
backup_retention_monthly: 6
-69
View File
@@ -1,69 +0,0 @@
---
- name: Install and initialize restic
become: true
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
register: restic_check
changed_when: false
failed_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
dest: /etc/restic-backup.env
owner: root
group: root
mode: "0600" ## only root can read this file
- name: Deploy restic backup script
ansible.builtin.template:
src: restic-backup.sh.j2
dest: /usr/local/bin/restic-backup.sh
owner: root
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
dest: /etc/systemd/system/restic-backup.service
owner: root
group: root
mode: "0644"
- name: Deploy restic systemd timer
ansible.builtin.template:
src: restic-backup.timer.j2
dest: /etc/systemd/system/restic-backup.timer
owner: root
group: root
mode: "0644"
- name: Enable and start backup timer
ansible.builtin.systemd:
name: restic-backup.timer
enabled: yes
state: started
daemon_reload: yes
@@ -1,5 +0,0 @@
# Ansible managed
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 }}"
@@ -1,8 +0,0 @@
[Unit]
Description=Run Restic Backup
After=network-online.target
[Service]
Type=oneshot
EnvironmentFile=/etc/restic-backup.env
ExecStart=/usr/local/bin/restic-backup.sh
@@ -1,26 +0,0 @@
#!/bin/bash
## Ansible managed
set -e
## Environment is injected by the systemd unit via EnvironmentFile=/etc/restic-backup.env. Run manually with: systemctl start restic-backup.service
echo "Starting Restic Backup at $(date)"
## Run the backup using paths and exclusions defined as group_vars
restic backup \
{% for path in backup_include_paths %}
"{{ path }}" \
{% endfor %}
{% for path in backup_exclude_paths %}
--exclude "{{ path }}" \
{% endfor %}
--cleanup-cache
restic forget \
--prune \
--keep-daily {{ backup_retention_daily }} \
--keep-weekly {{ backup_retention_weekly }} \
--keep-monthly {{ backup_retention_monthly }}
echo "Restic backup completed at $(date)"
@@ -1,10 +0,0 @@
[Unit]
Description=Run Restic Backup
[Timer]
OnCalendar=*-*-* 04:00:00
Persistent=true
RandomizedDelaySec=1800
[Install]
WantedBy=timers.target
+16
View File
@@ -0,0 +1,16 @@
---
galaxy_info:
author: Studio Vitali
description: Installs essential system utilities on Debian.
license: MIT
min_ansible_version: "2.15"
platforms:
- name: Debian
versions:
- bookworm
- trixie
galaxy_tags:
- apt
dependencies: []
allow_duplicates: false
+17
View File
@@ -0,0 +1,17 @@
---
galaxy_info:
author: Studio Vitali
description: Installs Docker Engine on Debian.
license: MIT
min_ansible_version: "2.15"
platforms:
- name: Debian
versions:
- bookworm
- trixie
galaxy_tags:
- docker
- container
dependencies: []
allow_duplicates: true