W3cubDocs

/Ansible

digital_ocean_sshkey - Create/delete an SSH key in DigitalOcean

New in version 1.6.

Synopsis

Create/delete an SSH key.

Requirements (on host that executes module)

  • python >= 2.6
  • dopy

Options

parameter required default choices comments
api_key
no
DigitalOcean api key.
client_id
no
DigitalOcean manager id.
id
no
Numeric, the SSH key id you want to operate on.
name
no
String, this is the name of an SSH key to create or destroy.
ssh_pub_key
no
The public SSH key you want to add to your account.
state
no present
  • present
  • absent
Indicate desired state of the target.

Examples

# Ensure a SSH key is present
# If a key matches this name, will return the ssh key id and changed = False
# If no existing key matches this name, a new key is created, the ssh key id is returned and changed = False

- digital_ocean_sshkey:
    state: present
    name: my_ssh_key
    ssh_pub_key: 'ssh-rsa AAAA...'
    client_id: XXX
    api_key: XXX

Notes

Note

Two environment variables can be used, DO_CLIENT_ID and DO_API_KEY.

Note

Version 1 of DigitalOcean API is used.

This is a Core Module

For more information on what this means please read Core Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/digital_ocean_sshkey_module.html