Update documentation
This commit is contained in:
parent
3efba3f529
commit
fa0595e72b
1 changed files with 87 additions and 44 deletions
131
cloud/linode
131
cloud/linode
|
@ -16,25 +16,20 @@
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: rax
|
module: linode
|
||||||
short_description: create / delete an instance in Rackspace Public Cloud
|
short_description: create / delete / stop / restart an instance in Linode Public Cloud
|
||||||
description:
|
description:
|
||||||
- creates / deletes a Rackspace Public Cloud instance and optionally waits for it to be 'running'.
|
- creates / deletes a Linode Public Cloud instance and optionally waits for it to be 'running'.
|
||||||
version_added: "1.2"
|
version_added: "1.3"
|
||||||
options:
|
options:
|
||||||
service:
|
|
||||||
description:
|
|
||||||
- Cloud service to interact with
|
|
||||||
choices: ['cloudservers']
|
|
||||||
default: cloudservers
|
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Indicate desired state of the resource
|
- Indicate desired state of the resource
|
||||||
choices: ['present', 'active', 'absent', 'deleted']
|
choices: ['present', 'active', 'started', absent', 'deleted', 'stopped', 'restarted']
|
||||||
default: present
|
default: present
|
||||||
creds_file:
|
api_key:
|
||||||
description:
|
description:
|
||||||
- File to find the Rackspace Public Cloud credentials in
|
- Linode API key
|
||||||
default: null
|
default: null
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
|
@ -42,29 +37,40 @@ options:
|
||||||
default: null
|
default: null
|
||||||
flavor:
|
flavor:
|
||||||
description:
|
description:
|
||||||
- flavor to use for the instance
|
- flavor to use for the instance (Linode plan)
|
||||||
default: null
|
default: null
|
||||||
|
type: integer
|
||||||
|
payment_term:
|
||||||
|
description:
|
||||||
|
- payment term to use for the instance (payment term in months)
|
||||||
|
default: 1
|
||||||
|
type: integer
|
||||||
|
choices: [1, 12, 24]
|
||||||
|
password:
|
||||||
|
description:
|
||||||
|
- root password to apply to a new server (auto generated if missing)
|
||||||
|
default: null
|
||||||
|
type: string
|
||||||
|
ssh_pub_key:
|
||||||
|
description:
|
||||||
|
- SSH public key applied to root user
|
||||||
|
default: null
|
||||||
|
type: string
|
||||||
|
swap:
|
||||||
|
description:
|
||||||
|
- swap size in MB
|
||||||
|
default: 512
|
||||||
|
type: integer
|
||||||
image:
|
image:
|
||||||
description:
|
description:
|
||||||
- image to use for the instance
|
- image to use for the instance (Linode Distribution)
|
||||||
default: null
|
|
||||||
meta:
|
|
||||||
description:
|
|
||||||
- A hash of metadata to associate with the instance
|
|
||||||
default: null
|
|
||||||
key_name:
|
|
||||||
description:
|
|
||||||
- key pair to use on the instance
|
|
||||||
default: null
|
|
||||||
aliases: ['keypair']
|
|
||||||
files:
|
|
||||||
description:
|
|
||||||
- Files to insert into the instance. remotefilename:localcontent
|
|
||||||
default: null
|
default: null
|
||||||
|
type: integer
|
||||||
region:
|
region:
|
||||||
description:
|
description:
|
||||||
- Region to create an instance in
|
- Region to create an instance in (Linode Datacenter)
|
||||||
default: null
|
default: null
|
||||||
|
type: integer
|
||||||
wait:
|
wait:
|
||||||
description:
|
description:
|
||||||
- wait for the instance to be in state 'running' before returning
|
- wait for the instance to be in state 'running' before returning
|
||||||
|
@ -74,25 +80,67 @@ options:
|
||||||
description:
|
description:
|
||||||
- how long before wait gives up, in seconds
|
- how long before wait gives up, in seconds
|
||||||
default: 300
|
default: 300
|
||||||
requirements: [ "pyrax" ]
|
requirements: [ "linode-python" ]
|
||||||
author: Jesse Keating
|
author: Vincent Viallet
|
||||||
notes:
|
notes:
|
||||||
- Two environment variables can be used, RAX_CREDS and RAX_REGION.
|
- LINODE_API_KEY env variable can be used instead
|
||||||
- RAX_CREDS points to a credentials file appropriate for pyrax
|
|
||||||
- RAX_REGION defines a Rackspace Public Cloud region (DFW, ORD, LON, ...)
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Create a server
|
# Create a server
|
||||||
- local_action:
|
- local_action:
|
||||||
module: rax
|
module: linode
|
||||||
creds_file: ~/.raxpub
|
api_key: 'longStringFromLinodeApi'
|
||||||
service: cloudservers
|
name: linode-test1
|
||||||
name: rax-test1
|
flavor: 1
|
||||||
flavor: 5
|
region: 2
|
||||||
image: b11d9567-e412-4255-96b9-bd63ab23bcfe
|
image: 99
|
||||||
|
password: 'superSecureRootPassword'
|
||||||
|
ssh_pub_key: 'ssh-rsa qwerty'
|
||||||
|
swap: 768
|
||||||
wait: yes
|
wait: yes
|
||||||
|
wait_timeout: 600
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
# Ensure a running server (create if missing)
|
||||||
|
- local_action:
|
||||||
|
module: linode
|
||||||
|
api_key: 'longStringFromLinodeApi'
|
||||||
|
name: linode-test1
|
||||||
|
linode_id: 12345678
|
||||||
|
flavor: 1
|
||||||
|
region: 2
|
||||||
|
image: 99
|
||||||
|
password: 'superSecureRootPassword'
|
||||||
|
ssh_pub_key: 'ssh-rsa qwerty'
|
||||||
|
swap: 768
|
||||||
|
wait: yes
|
||||||
|
wait_timeout: 600
|
||||||
|
state: present
|
||||||
|
|
||||||
|
# Delete a server
|
||||||
|
- local_action:
|
||||||
|
module: linode
|
||||||
|
api_key: 'longStringFromLinodeApi'
|
||||||
|
name: linode-test1
|
||||||
|
linode_id: 12345678
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
# Stop a server
|
||||||
|
- local_action:
|
||||||
|
module: linode
|
||||||
|
api_key: 'longStringFromLinodeApi'
|
||||||
|
name: linode-test1
|
||||||
|
linode_id: 12345678
|
||||||
|
state: stopped
|
||||||
|
|
||||||
|
# Reboot a server
|
||||||
|
- local_action:
|
||||||
|
module: linode
|
||||||
|
api_key: 'longStringFromLinodeApi'
|
||||||
|
name: linode-test1
|
||||||
|
linode_id: 12345678
|
||||||
|
state: restarted
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -148,11 +196,6 @@ def getInstanceDetails(api, server):
|
||||||
|
|
||||||
def linodeServers(module, api, state, name, flavor, image, region, linode_id,
|
def linodeServers(module, api, state, name, flavor, image, region, linode_id,
|
||||||
payment_term, password, ssh_pub_key, swap, wait, wait_timeout):
|
payment_term, password, ssh_pub_key, swap, wait, wait_timeout):
|
||||||
# Check our args (this could be done better)
|
|
||||||
for arg in (state, name, flavor, image):
|
|
||||||
if not arg:
|
|
||||||
module.fail_json(msg='%s is required for cloudservers' % arg)
|
|
||||||
|
|
||||||
instances = []
|
instances = []
|
||||||
changed = False
|
changed = False
|
||||||
new_server = False
|
new_server = False
|
||||||
|
|
Loading…
Reference in a new issue