ansible-role-borgbackup/tasks/main.yml

30 lines
792 B
YAML
Raw Normal View History

2023-04-08 19:17:38 +02:00
---
- name: Generate an OpenSSH keypair
community.crypto.openssh_keypair:
path: "{{ backup_ssh_key_path }}"
type: "ed25519"
- name: Read key from file
ansible.builtin.slurp:
src: "{{ backup_ssh_key_path }}.pub"
register: ssh_key
check_mode: true
- name: Add key to borgbase
adhawkins.borgbase.borgbase_ssh:
state: present
apikey: "{{ borgbase_api_key }}"
name: "{{ borgbase_ssh_key_name }}"
key: "{{ (ssh_key.content | b64decode).split()[:2] | join(' ') }}"
register: borgbase_key
- name: Create repo
2023-04-08 19:36:31 +02:00
adhawkins.borgbase.borgbase_repo:
2023-04-08 19:17:38 +02:00
state: present
apikey: "{{ borgbase_api_key }}"
name: "{{ ansible_hostname }}"
full_access_keys: ["{{ borgbase_key.key_id }}"]
quota_enabled: false
alert_days: 1
register: borgbase_repo