adhawkins.borgbase.borgbase_ssh module – Module for managing SSH keys 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_ssh.

New in adhawkins.borgbase 1.0.0

Synopsis

  • Module for managing SSH keys in borgbase.

Parameters

Parameter

Comments

apikey

string

The borgbase API key.

email

string

The email address associated with the borgbase account.

key

string

The SSH public key (required if state is ‘present’).

name

string / required

The SSH key name.

password

string

The password for the borgbase account.

state

string

‘present’ to ensure the key exists, ‘absent’ to ensure it doesn’t. When removing a key the match is carried out based on key name only. When adding a key, if a key exists with the same name but different content, the key will be silently replaced.

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: Dump create results
  debug:
    var: borgbase_key.key_id

Return Values

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

Key

Description

key_id

integer

The ID of the key that was created or deleted.

Returned: always

Authors

  • Andy Hawkins (@adhawkins)