commit
6d66b0e965
1 changed files with 19 additions and 16 deletions
35
library/rax
35
library/rax
|
@ -17,42 +17,36 @@
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: rax
|
module: rax
|
||||||
short_description: create an instance in Rackspace Public Cloud, return instanceid
|
short_description: create / delete an instance in Rackspace Public Cloud
|
||||||
description:
|
description:
|
||||||
- creates Rackspace Public Cloud instances and optionally waits for it to be 'running'.
|
- creates / deletes Rackspace Public Cloud instances and optionally waits for it to be 'running'.
|
||||||
version_added: "1.2"
|
version_added: "1.2"
|
||||||
options:
|
options:
|
||||||
service:
|
service:
|
||||||
description:
|
description:
|
||||||
- Cloud service to interact with
|
- Cloud service to interact with
|
||||||
required: false
|
choices: ['cloudservers']
|
||||||
choices: ['cloudservers', 'cloudfiles', 'cloud_databases', 'cloud_loadbalancers']
|
|
||||||
default: cloudservers
|
default: cloudservers
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Indicate desired state of the resource
|
- Indicate desired state of the resource
|
||||||
required: false
|
|
||||||
choices: ['present', 'active', 'absent', 'deleted']
|
choices: ['present', 'active', 'absent', 'deleted']
|
||||||
default: present
|
default: present
|
||||||
creds_file:
|
creds_file:
|
||||||
description:
|
description:
|
||||||
- File to find the Rackspace Public Cloud credentials in
|
- File to find the Rackspace Public Cloud credentials in
|
||||||
required: false
|
|
||||||
default: null
|
default: null
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- Name to give the instance
|
- Name to give the instance
|
||||||
required: false
|
|
||||||
default: null
|
default: null
|
||||||
flavor:
|
flavor:
|
||||||
description:
|
description:
|
||||||
- flavor to use for the instance
|
- flavor to use for the instance
|
||||||
required: false
|
|
||||||
default: null
|
default: null
|
||||||
image:
|
image:
|
||||||
description:
|
description:
|
||||||
- image to use for the instance
|
- image to use for the instance
|
||||||
required: false
|
|
||||||
default: null
|
default: null
|
||||||
meta:
|
meta:
|
||||||
description:
|
description:
|
||||||
|
@ -61,7 +55,6 @@ options:
|
||||||
key_name:
|
key_name:
|
||||||
description:
|
description:
|
||||||
- key pair to use on the instance
|
- key pair to use on the instance
|
||||||
required: false
|
|
||||||
default: null
|
default: null
|
||||||
aliases: ['keypair']
|
aliases: ['keypair']
|
||||||
files:
|
files:
|
||||||
|
@ -71,12 +64,10 @@ options:
|
||||||
region:
|
region:
|
||||||
description:
|
description:
|
||||||
- Region to create an instance in
|
- Region to create an instance in
|
||||||
required: false
|
|
||||||
default: null
|
default: null
|
||||||
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
|
||||||
required: false
|
|
||||||
default: "no"
|
default: "no"
|
||||||
choices: [ "yes", "no" ]
|
choices: [ "yes", "no" ]
|
||||||
wait_timeout:
|
wait_timeout:
|
||||||
|
@ -84,8 +75,18 @@ options:
|
||||||
- how long before wait gives up, in seconds
|
- how long before wait gives up, in seconds
|
||||||
default: 300
|
default: 300
|
||||||
examples:
|
examples:
|
||||||
- code: 'local_action: rax creds_file=~/.raxpub service=cloudservers name=rax-test1 flavor=5 image=b11d9567-e412-4255-96b9-bd63ab23bcfe wait=yes state=present'
|
- code: |
|
||||||
description: "Examples from Ansible Playbooks"
|
- name: Create a server
|
||||||
|
local_action:
|
||||||
|
module: rax
|
||||||
|
creds_file: ~/.raxpub
|
||||||
|
service: cloudservers
|
||||||
|
name: rax-test1
|
||||||
|
flavor: 5
|
||||||
|
image: b11d9567-e412-4255-96b9-bd63ab23bcfe
|
||||||
|
wait: yes
|
||||||
|
state: present
|
||||||
|
description: "Example from Ansible Playbooks"
|
||||||
requirements: [ "pyrax" ]
|
requirements: [ "pyrax" ]
|
||||||
author: Jesse Keating
|
author: Jesse Keating
|
||||||
notes:
|
notes:
|
||||||
|
@ -104,8 +105,10 @@ except ImportError:
|
||||||
print("failed=True msg='pyrax required for this module'")
|
print("failed=True msg='pyrax required for this module'")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
SUPPORTEDSERVICES = ['cloudservers', 'cloudfiles', 'cloud_blockstorage',
|
# These are possible services, but only cloudservers is supported at this time
|
||||||
'cloud_databases', 'cloud_loadbalancers']
|
#SUPPORTEDSERVICES = ['cloudservers', 'cloudfiles', 'cloud_blockstorage',
|
||||||
|
# 'cloud_databases', 'cloud_loadbalancers']
|
||||||
|
SUPPORTEDSERVICES = ['cloudservers']
|
||||||
|
|
||||||
def cloudservers(module, state, name, flavor, image, meta, key_name, files,
|
def cloudservers(module, state, name, flavor, image, meta, key_name, files,
|
||||||
wait, wait_timeout):
|
wait, wait_timeout):
|
||||||
|
|
Loading…
Reference in a new issue