community / community.digitalocean / 1.26.0 / module / digital_ocean_sshkey Manage DigitalOcean SSH keys Authors: Patrick Marques (@pmarques)community.digitalocean.digital_ocean_sshkey (1.26.0) — module
Install with ansible-galaxy collection install community.digitalocean:==1.26.0
collections: - name: community.digitalocean version: 1.26.0
Create/delete DigitalOcean SSH keys.
- name: "Create ssh key" community.digitalocean.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
- name: "Delete ssh key" community.digitalocean.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"
name: description: - The name for the SSH key type: str state: choices: - present - absent default: present description: - Indicate desired state of the target. type: str baseurl: default: https://api.digitalocean.com/v2 description: - DigitalOcean API base url. type: str timeout: default: 30 description: - The timeout in seconds used for polling DigitalOcean's API. type: int fingerprint: aliases: - id description: - This is a unique identifier for the SSH key used to delete a key type: str oauth_token: aliases: - api_token description: - DigitalOcean OAuth token. - There are several other environment variables which can be used to provide this value. - i.e., - C(DO_API_TOKEN), C(DO_API_KEY), C(DO_OAUTH_TOKEN) and C(OAUTH_TOKEN). type: str ssh_pub_key: description: - The Public SSH key to add. type: str validate_certs: default: true description: - If set to C(no), the SSL certificates will not be validated. - This should only set to C(no) used on personally controlled sites using self-signed certificates. type: bool
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