1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Accept a comma-separated list of regions

This commit is contained in:
Paul Durivage 2013-10-17 11:18:07 -05:00
parent 16336db9f6
commit 7c88ac0a5e

View file

@ -70,13 +70,15 @@ notes:
- RAX_CREDS_FILE points to a credentials file appropriate for pyrax.
- 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, 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" ]
examples:
- description: List server instances
code: RAX_CREDS_FILE=~/.raxpub rax.py --list
- description: List servers in ORD datacenter only
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"
code: RAX_CREDS_FILE=~/.raxpub rax.py --host server.example.com
'''
@ -128,7 +130,8 @@ def _list(region):
hostvars = collections.defaultdict(dict)
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
for region in pyrax.regions: