community.general.digital_ocean_sshkey (0.2.1) — module

Manage DigitalOcean SSH keys

Authors: Patrick Marques (@pmarques)

Install collection

Install with ansible-galaxy collection install community.general:==0.2.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.2.1

Description

Create/delete DigitalOcean SSH keys.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Create ssh key"
  digital_ocean_sshkey:
    oauth_token: "{{ oauth_token }}"
    name: "My SSH Public Key"
    ssh_pub_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V example"
    state: present
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Delete ssh key"
  digital_ocean_sshkey:
    oauth_token: "{{ oauth_token }}"
    state: "absent"
    fingerprint: "3b:16:bf:e4:8b:00:8b:b8:59:8c:a9:d3:f0:19:45:fa"

Inputs

    
name:
    description:
    - The name for the SSH key

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Indicate desired state of the target.

fingerprint:
    aliases:
    - id
    description:
    - This is a unique identifier for the SSH key used to delete a key

oauth_token:
    description:
    - DigitalOcean OAuth token.
    required: true

ssh_pub_key:
    description:
    - The Public SSH key to add.

Outputs

data:
  description: This is only present when C(state=present)
  returned: when C(state=present)
  sample:
    ssh_key:
      fingerprint: 3b:16:bf:e4:8b:00:8b:b8:59:8c:a9:d3:f0:19:45:fa
      id: 512189
      name: My SSH Public Key
      public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V
        example
  type: dict