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:
parent
16336db9f6
commit
7c88ac0a5e
1 changed files with 5 additions and 2 deletions
|
@ -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):
|
||||||
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:
|
||||||
|
|
Loading…
Reference in a new issue