31 lines
900 B
YAML
31 lines
900 B
YAML
---
|
|
- name: Read key from file
|
|
ansible.builtin.slurp:
|
|
src: "{{ borg_ssh_key_file_path }}.pub"
|
|
register: ssh_key
|
|
|
|
- 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.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
|
|
|
|
- name: Set borgbase repo id
|
|
ansible.builtin.set_fact:
|
|
borgbackup_borgbase_repo: "{{ borgbase_repo.repo_id }}"
|
|
|
|
- name: Set borgbackup_ssh_host
|
|
ansible.builtin.set_fact:
|
|
borgbackup_ssh_host: "{{ borgbackup_borgbase_repo }}.repo.borgbase.com"
|