Initial commit

This commit is contained in:
phil 2023-04-08 19:17:38 +02:00
commit 2d8d83aedc
3 changed files with 44 additions and 0 deletions

3
defaults/main.yml Normal file
View file

@ -0,0 +1,3 @@
---
backup_ssh_key_path: /root/.ssh/borgbase_backup
borgbase_ssh_key_name: "backup@{{ inventory_hostname }}"

12
meta/main.yml Normal file
View file

@ -0,0 +1,12 @@
galaxy_info:
author: Sense.Lab e.V. administrators
description: Role to configure borgbase repositories and ssh keys
company: Sense.Lab e.V.
license: GPLv3
min_ansible_version: "2.9"
platforms:
- name: Debian
versions:
- bullseye
dependencies:
- name: adhawkins.borgbase

29
tasks/main.yml Normal file
View file

@ -0,0 +1,29 @@
---
- 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
adhawkins.borgbase_repo:
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