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
7c88ac0a
Commit
7c88ac0a
authored
Oct 17, 2013
by
Paul Durivage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept a comma-separated list of regions
parent
16336db9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
plugins/inventory/rax.py
+5
-2
No files found.
plugins/inventory/rax.py
View file @
7c88ac0a
...
@@ -70,13 +70,15 @@ notes:
...
@@ -70,13 +70,15 @@ notes:
- RAX_CREDS_FILE points to a credentials file appropriate for pyrax.
- RAX_CREDS_FILE points to a credentials file appropriate for pyrax.
- See https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#authenticating
- See https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#authenticating
- RAX_REGION is an optional environment variable to narrow inventory search scope
- RAX_REGION is an optional environment variable to narrow inventory search scope
- RAX_REGION, if used, needs a value like ORD, DFW, SYD (a Rackspace datacenter)
- RAX_REGION, if used, needs a value like ORD, DFW, SYD (a Rackspace datacenter)
and optionally accepts a comma-separated list
requirements: [ "pyrax" ]
requirements: [ "pyrax" ]
examples:
examples:
- description: List server instances
- description: List server instances
code: RAX_CREDS_FILE=~/.raxpub rax.py --list
code: RAX_CREDS_FILE=~/.raxpub rax.py --list
- description: List servers in ORD datacenter only
- description: List servers in ORD datacenter only
code: RAX_CREDS_FILE=~/.raxpub RAX_REGION=ORD rax.py --list
code: RAX_CREDS_FILE=~/.raxpub RAX_REGION=ORD rax.py --list
- description: List servers in ORD and DFW datacenters
code: RAX_CREDS_FILE=~/.raxpub RAX_REGION=ORD,DFW rax.py --list
- description: Get server details for server named "server.example.com"
- description: Get server details for server named "server.example.com"
code: RAX_CREDS_FILE=~/.raxpub rax.py --host server.example.com
code: RAX_CREDS_FILE=~/.raxpub rax.py --host server.example.com
'''
'''
...
@@ -128,7 +130,8 @@ def _list(region):
...
@@ -128,7 +130,8 @@ def _list(region):
hostvars
=
collections
.
defaultdict
(
dict
)
hostvars
=
collections
.
defaultdict
(
dict
)
if
region
and
region
.
upper
()
in
pyrax
.
regions
:
if
region
and
region
.
upper
()
in
pyrax
.
regions
:
pyrax
.
regions
=
(
region
,)
pyrax
.
regions
=
(
region
.
upper
()
for
region
in
region
.
split
(
','
))
# Go through all the regions looking for servers
# Go through all the regions looking for servers
for
region
in
pyrax
.
regions
:
for
region
in
pyrax
.
regions
:
...
...
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