1
0
Fork 0
ansible-collection-proxmox-.../roles/backup/tasks/main.yml
Nis Wechselberg 2eceb3e269
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
nitial version of proxmox backup collection
Signed-off-by: Nis Wechselberg <enbewe@enbewe.de>
2025-05-08 15:14:18 +02:00

72 lines
2.2 KiB
YAML

---
- name: 'Install proxmox repository signing key'
become: true
ansible.builtin.get_url:
url: '{{ backup_proxmox_signing_key_url }}'
dest: '{{ backup_proxmox_signing_key_file }}'
owner: 'root'
group: 'root'
mode: 'u=rw,g=r,o=r'
- name: 'Install proxmox backup software repository'
become: true
ansible.builtin.apt_repository:
repo: 'deb [arch=amd64 signed-by={{ backup_proxmox_signing_key_file }}] {{ backup_proxmox_repo_url }} bookworm main'
filename: 'pbs-client'
- name: 'Install static proxmox backup client'
become: true
ansible.builtin.apt:
name: 'proxmox-backup-client-static'
state: 'present'
- name: 'Create directory for encryption key'
become: true
ansible.builtin.file:
path: '/root/.config/proxmox-backup'
state: 'directory'
owner: 'root'
group: 'root'
mode: 'u=rwx,g=rx,o=rx'
- name: 'Deploy encryption key to host'
become: true
ansible.builtin.template:
src: 'encryption-key.json.j2'
dest: '/root/.config/proxmox-backup/encryption-key.json'
owner: 'root'
group: 'root'
mode: 'u=rw,g=,o='
- name: 'Create cronjob'
become: true
block:
- name: 'Generate the cronjob itself'
ansible.builtin.cron:
cron_file: 'proxmox-backup'
user: 'root'
name: 'proxmox-backup'
job: 'proxmox-backup-client backup {{ backup_proxmox_paths }}'
hour: '{{ backup_proxmox_cron_hour }}'
minute: '{{ backup_proxmox_cron_minute }}'
- name: 'Configure environment variable for repository'
ansible.builtin.cron:
cron_file: 'proxmox-backup'
user: 'root'
env: true
name: 'PBS_REPOSITORY'
value: '{{ backup_proxmox_repository }}'
- name: 'Configure environment variable for user password'
ansible.builtin.cron:
cron_file: 'proxmox-backup'
user: 'root'
env: true
name: 'PBS_PASSWORD'
value: '{{ backup_proxmox_password }}'
- name: 'Configure environment variable for encryption'
ansible.builtin.cron:
cron_file: 'proxmox-backup'
user: 'root'
env: true
name: 'PBS_ENCRYPTION_PASSWORD'
value: '{{ backup_proxmox_encryption_password }}'