mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Rename digital ocean module to digital_ocean, add documentation.
This commit is contained in:
parent
66b5689afb
commit
cc1cb01540
1 changed files with 26 additions and 8 deletions
|
@ -17,7 +17,7 @@
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: do
|
module: digital_ocean
|
||||||
short_description: Create/delete a droplet/SSH_key in DigitalOcean
|
short_description: Create/delete a droplet/SSH_key in DigitalOcean
|
||||||
description:
|
description:
|
||||||
- Create/delete a droplet in DigitalOcean and optionally waits for it to be 'running', or deploy an SSH key.
|
- Create/delete a droplet in DigitalOcean and optionally waits for it to be 'running', or deploy an SSH key.
|
||||||
|
@ -75,12 +75,30 @@ notes:
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# a playbook task line:
|
# Ensure a SSH key is present
|
||||||
tasks:
|
- digital_ocean: state=present command=ssh name=my_ssh_key ssh_pub_key='ssh-rsa AAAA...' client_id=XXX api_key=XXX
|
||||||
- do: state=present client_id=XXX api_key=XXX id=33
|
|
||||||
|
|
||||||
# /usr/bin/ansible invocations
|
If a key matches this name, will return the ssh key id and changed = False
|
||||||
ansible -i host -m do -a "state=present client_id=XXX api_key=XXX id=3"
|
If no existing key matches this name, a new key is created, the ssh key id is returned and changed = False
|
||||||
|
|
||||||
|
# Create a new Droplet
|
||||||
|
- digital_ocean: state=present command=droplet name=my_new_droplet client_id=XXX api_key=XXX size_id=1 region_id=2 image_id=3 wait_timeout=500
|
||||||
|
|
||||||
|
Will return the droplet details including the droplet id (used for idempotence)
|
||||||
|
|
||||||
|
# Ensure a droplet is present
|
||||||
|
- digital_ocean: state=present command=droplet id=123 name=my_new_droplet client_id=XXX api_key=XXX size_id=1 region_id=2 image_id=3 wait_timeout=500
|
||||||
|
|
||||||
|
If droplet id already exist, will return the droplet details and changed = False
|
||||||
|
If no droplet matches the id, a new droplet will be created and the droplet details (including the new id) are returned, changed = True.
|
||||||
|
|
||||||
|
# Create a droplet with ssh key
|
||||||
|
- digital_ocean: state=present ssh_key_ids=id name=my_new_droplet client_id=XXX api_key=XXX size_id=1 region_id=2 image_id=3
|
||||||
|
|
||||||
|
The ssh key id can be passed as argument at the creation of a droplet (see ssh_key_ids).
|
||||||
|
Several keys can be added to ssh_key_ids as id1,id2,id3
|
||||||
|
|
||||||
|
The keys are used to connect as root to the droplet.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -277,8 +295,8 @@ def core(module):
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
command = dict(required=True, choices=['droplet', 'ssh']),
|
command = dict(required=True, choices=['droplet', 'ssh'], default='droplet'),
|
||||||
state = dict(required=True, choices=['active', 'present', 'absent', 'deleted']),
|
state = dict(required=True, choices=['active', 'present', 'absent', 'deleted'], default='present'),
|
||||||
client_id = dict(aliases=['CLIENT_ID'], no_log=True),
|
client_id = dict(aliases=['CLIENT_ID'], no_log=True),
|
||||||
api_key = dict(aliases=['API_KEY'], no_log=True),
|
api_key = dict(aliases=['API_KEY'], no_log=True),
|
||||||
name = dict(type='str'),
|
name = dict(type='str'),
|
Loading…
Reference in a new issue