/ansible-borgbase

Ansible modules for managing borgbase SSH keys and repositories

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Ansible Collection - adhawkins.borgbase

This repo hosts the adhawkins.borgbase Ansible Collection.

The collection includes modules for managing SSH keys and repositories on the BorgBase service.

Installation and Usage

Installing the Collection from Ansible Galaxy

Before using the collection, you need to install the collection with the ansible-galaxy CLI:

ansible-galaxy collection install adhawkins.borgbase

You can also include it in a requirements.yml file and install it through ansible-galaxy collection install -r requirements.yml using the format:

collections:
- name: adhawkins.borgbase

Playbooks

To use a module from the collection, please reference the full namespace, collection name, and module name that you want to use:

---
- hosts: all

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

    - name: Create key
      adhawkins.borgbase.borgbase_ssh:
        state: present
        apikey: "{{ borgbase_apikey }}"
        name: "ANSIBLE-1"
        key: "{{ ssh_key['content'] | b64decode }}"
      register: borgbase_key

    - name: Dump create results
      debug:
        var: borgbase_key.key_id

Or you can add the full namespace and collection name in the collections element:

---
- hosts: all

  collections:
    - adhawkins.borgbase

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

    - name: Create key
      borgbase_ssh:
        state: present
        apikey: "{{ borgbase_apikey }}"
        name: "ANSIBLE-1"
        key: "{{ ssh_key['content'] | b64decode }}"
      register: borgbase_key

    - name: Dump create results
      debug:
        var: borgbase_key.key_id

Usage

See the collection docs:

License

GNU General Public License v3.0 or later