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
1ac7dffd
Commit
1ac7dffd
authored
Jan 24, 2014
by
Matt Martz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support using ~/.pyrax.cfg and multi environments
parent
139e905e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
lib/ansible/module_utils/rax.py
+19
-8
No files found.
lib/ansible/module_utils/rax.py
View file @
1ac7dffd
...
...
@@ -2,16 +2,16 @@ import os
def
rax_argument_spec
():
auth_endpoint
=
'https://identity.api.rackspacecloud.com/v2.0/'
return
dict
(
api_key
=
dict
(
type
=
'str'
,
aliases
=
[
'password'
],
no_log
=
True
),
auth_endpoint
=
dict
(
type
=
'str'
,
default
=
auth_endpoint
),
auth_endpoint
=
dict
(
type
=
'str'
),
credentials
=
dict
(
type
=
'str'
,
aliases
=
[
'creds_file'
]),
env
=
dict
(
type
=
'str'
),
identity_type
=
dict
(
type
=
'str'
,
default
=
'rackspace'
),
region
=
dict
(
type
=
'str'
),
tenant_id
=
dict
(
type
=
'str'
),
username
=
dict
(
type
=
'str'
),
verify_ssl
=
dict
(
choices
=
BOOLEANS
,
default
=
True
,
type
=
'bool'
),
verify_ssl
=
dict
(
choices
=
BOOLEANS
,
type
=
'bool'
),
)
...
...
@@ -23,24 +23,35 @@ def setup_rax_module(module, rax_module):
api_key
=
module
.
params
.
get
(
'api_key'
)
auth_endpoint
=
module
.
params
.
get
(
'auth_endpoint'
)
credentials
=
module
.
params
.
get
(
'credentials'
)
env
=
module
.
params
.
get
(
'env'
)
identity_type
=
module
.
params
.
get
(
'identity_type'
)
region
=
module
.
params
.
get
(
'region'
)
tenant_id
=
module
.
params
.
get
(
'tenant_id'
)
username
=
module
.
params
.
get
(
'username'
)
verify_ssl
=
module
.
params
.
get
(
'verify_ssl'
)
if
env
is
not
None
:
rax_module
.
set_environment
(
env
)
rax_module
.
set_setting
(
'identity_type'
,
identity_type
)
rax_module
.
set_setting
(
'verify_ssl'
,
verify_ssl
)
rax_module
.
set_setting
(
'auth_endpoint'
,
auth_endpoint
)
if
tenant_id
:
if
verify_ssl
is
not
None
:
rax_module
.
set_setting
(
'verify_ssl'
,
verify_ssl
)
if
auth_endpoint
is
not
None
:
rax_module
.
set_setting
(
'auth_endpoint'
,
auth_endpoint
)
if
tenant_id
is
not
None
:
rax_module
.
set_setting
(
'tenant_id'
,
tenant_id
)
try
:
username
=
username
or
os
.
environ
.
get
(
'RAX_USERNAME'
)
api_key
=
api_key
or
os
.
environ
.
get
(
'RAX_API_KEY'
)
if
not
username
:
username
=
rax_module
.
get_setting
(
'keyring_username'
)
api_key
=
'USE_KEYRING'
if
not
api_key
:
api_key
=
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'
)
region
=
(
region
or
os
.
environ
.
get
(
'RAX_REGION'
)
or
rax_module
.
get_setting
(
'region'
))
except
KeyError
,
e
:
module
.
fail_json
(
msg
=
'Unable to load
%
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