adhawkins.borgbase.borgbase_repo module – Module for managing repos in borgbase.

Note

This module is part of the adhawkins.borgbase collection (version 1.0.3).

To install it, use: ansible-galaxy collection install adhawkins.borgbase.

To use it in a playbook, specify: adhawkins.borgbase.borgbase_repo.

New in adhawkins.borgbase 1.0.0

Synopsis

  • Module for managing repos in borgbase.

Parameters

Parameter

Comments

alert_days

integer

Number of days to send alerts if no activity detected.

Default: 7

apikey

string

The borgbase API key.

append_only

boolean

True if repo is append only.

Choices:

  • false ← (default)

  • true

append_only_keys

list / elements=string

List of keys for append only access.

borg_version

string

Version of borg to run on this repo.

Choices:

  • "latest" ← (default)

  • "1.1.x"

  • "1.2.x"

email

string

The email address associated with the borgbase account.

full_access_keys

list / elements=string

List of keys for full access.

name

string / required

Repo name.

password

string

The password for the borgbase account.

quota

integer

Disk quota for this repo (MB).

Default: 0

quota_enabled

boolean

Whether quota is enabled for this repo.

Choices:

  • false ← (default)

  • true

region

string

Repo region.

Choices:

  • "eu" ← (default)

  • "us"

state

string

‘present’ to ensure the repo exists, ‘absent’ to ensure it doesn’t.

Choices:

  • "absent"

  • "present" ← (default)

Examples

- name: Read key from file
  slurp:
    src: ~/.ssh/id_rsa.pub
  register: ssh_key
  check_mode: yes

- name: Create key
  borgbase_ssh:
    state: present
    email: "{{ borgbase_email }}"
    password: "{{ borgbase_password }}"
    name: "{{ whoami.stdout }}@{{ ansible_hostname }}"
    key: "{{ ssh_key['content'] | b64decode }}"
  register: borgbase_key

- name: Create repo
  borgbase_repo:
    state: present
    email: "{{ borgbase_email }}"
    password: "{{ borgbase_password }}"
    name: "{{ ansible_hostname }}"
    full_access_keys: [ "{{ borgbase_key.key_id }}" ]
    quota_enabled: false
    alert_days: 1
  register: borgbase_repo

- name: Set borgbase repo id
  set_fact:
    borgbackup_borgbase_repo: "{{ borgbase_repo.repo_id }}"

- name: Set borgbackup_ssh_host
  set_fact:
    borgbackup_ssh_host: "{{ borgbackup_borgbase_repo }}.repo.borgbase.com"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

repo_id

integer

The ID of the repo that was created or deleted.

Returned: always

Authors

  • Andy Hawkins (@adhawkins)