Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
4e5feb63
Commit
4e5feb63
authored
Aug 11, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3763 from j2sol/rax-updates
Update rax to sync with rax_clb_nodes
parents
eb54c222
87068865
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
22 deletions
+40
-22
library/cloud/rax
+40
-22
No files found.
library/cloud/rax
View file @
4e5feb63
...
...
@@ -32,10 +32,18 @@ options:
- Indicate desired state of the resource
choices: ['present', 'active', 'absent', 'deleted']
default: present
cred
s_file
:
cred
entials
:
description:
- File to find the Rackspace Public Cloud credentials in
- File to find the Rackspace credentials in (ignored if C(api_key) and
C(username) are provided)
default: null
aliases: ['creds_file']
api_key:
description:
- Rackspace API key (overrides C(credentials))
username:
description:
- Rackspace username (overrides C(credentials))
name:
description:
- Name to give the instance
...
...
@@ -64,7 +72,7 @@ options:
region:
description:
- Region to create an instance in
default:
null
default:
DFW
wait:
description:
- wait for the instance to be in state 'running' before returning
...
...
@@ -77,16 +85,19 @@ options:
requirements: [ "pyrax" ]
author: Jesse Keating
notes:
- Two environment variables can be used, RAX_CREDS and RAX_REGION.
- RAX_CREDS points to a credentials file appropriate for pyrax
- RAX_REGION defines a Rackspace Public Cloud region (DFW, ORD, LON, ...)
- The following environment variables can be used, C(RAX_USERNAME),
C(RAX_API_KEY), C(RAX_CREDS), C(RAX_CREDENTIALS), C(RAX_REGION).
- C(RAX_CREDENTIALS) and C(RAX_CREDS) points to a credentials file
appropriate for pyrax
- C(RAX_USERNAME) and C(RAX_API_KEY) obviate the use of a credentials file
- C(RAX_REGION) defines a Rackspace Public Cloud region (DFW, ORD, LON, ...)
'''
EXAMPLES
=
'''
# Create a server
- local_action:
module: rax
cred
s_file
: ~/.raxpub
cred
entials
: ~/.raxpub
service: cloudservers
name: rax-test1
flavor: 5
...
...
@@ -208,7 +219,9 @@ def main():
service
=
dict
(
default
=
'cloudservers'
,
choices
=
SUPPORTEDSERVICES
),
state
=
dict
(
default
=
'present'
,
choices
=
[
'active'
,
'present'
,
'deleted'
,
'absent'
]),
creds_file
=
dict
(),
credentials
=
dict
(
aliases
=
[
'creds_file'
]),
api_key
=
dict
(),
username
=
dict
(),
name
=
dict
(),
flavor
=
dict
(),
image
=
dict
(),
...
...
@@ -223,7 +236,9 @@ def main():
service
=
module
.
params
.
get
(
'service'
)
state
=
module
.
params
.
get
(
'state'
)
creds_file
=
module
.
params
.
get
(
'creds_file'
)
credentials
=
module
.
params
.
get
(
'credentials'
)
api_key
=
module
.
params
.
get
(
'api_key'
)
username
=
module
.
params
.
get
(
'username'
)
name
=
module
.
params
.
get
(
'name'
)
flavor
=
module
.
params
.
get
(
'flavor'
)
image
=
module
.
params
.
get
(
'image'
)
...
...
@@ -234,24 +249,27 @@ def main():
wait
=
module
.
params
.
get
(
'wait'
)
wait_timeout
=
int
(
module
.
params
.
get
(
'wait_timeout'
))
# Setup the credentials file
if
not
creds_file
:
try
:
creds_file
=
os
.
environ
[
'RAX_CREDS_FILE'
]
except
KeyError
,
e
:
module
.
fail_json
(
msg
=
'Unable to load
%
s'
%
e
.
message
)
# Setup the credentials and region
try
:
username
=
username
or
os
.
environ
.
get
(
'RAX_USERNAME'
)
api_key
=
api_key
or
os
.
environ
.
get
(
'RAX_API_KEY'
)
credentials
=
credentials
or
os
.
environ
.
get
(
'RAX_CREDENTIALS'
)
or
\
os
.
environ
.
get
(
'RAX_CREDS_FILE'
)
region
=
region
or
os
.
environ
.
get
(
'RAX_REGION'
)
# Define the region
if
not
region
:
try
:
region
=
os
.
environ
[
'RAX_REGION'
]
except
KeyError
,
e
:
module
.
fail_json
(
msg
=
'Unable to load
%
s'
%
e
.
message
)
except
KeyError
,
e
:
module
.
fail_json
(
msg
=
'Unable to load
%
s'
%
e
.
message
)
# setup the auth
try
:
pyrax
.
set_setting
(
"identity_type"
,
"rackspace"
)
pyrax
.
set_credential_file
(
creds_file
,
region
=
region
)
if
api_key
and
username
:
pyrax
.
set_credentials
(
username
,
api_key
=
api_key
,
region
=
region
)
elif
credentials
:
credentials
=
os
.
path
.
expanduser
(
credentials
)
pyrax
.
set_credential_file
(
credentials
,
region
=
region
)
else
:
raise
Exception
(
'No credentials supplied!'
)
except
Exception
,
e
:
module
.
fail_json
(
msg
=
'
%
s'
%
e
.
message
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment