tests: refactor gcloud.py to be dynamic inventory.

pull/255/head
David Wilson 7 years ago
parent a3995f8e5f
commit dbcee4041a

@ -1,5 +1,5 @@
[defaults]
inventory = hosts
inventory = hosts,lib/inventory
gathering = explicit
strategy_plugins = ../../ansible_mitogen/plugins/strategy
action_plugins = lib/action

@ -1,8 +1,13 @@
#!/usr/bin/env python
import json
import os
import sys
if not os.environ.get('MITOGEN_GCLOUD_GROUP'):
sys.stdout.write('{}')
sys.exit(0)
import googleapiclient.discovery
@ -24,11 +29,12 @@ def main():
#for config in interface['accessConfigs']
)
print 'Addresses:', ips
os.execvp('ansible-playbook', [
'anisble-playbook',
'--inventory-file=' + ','.join(ips) + ','
] + sys.argv[1:])
sys.stderr.write('Addresses: %s\n' % (ips,))
sys.stdout.write(json.dumps({
os.environ['MITOGEN_GCLOUD_GROUP']: {
'hosts': ips
}
}, indent=4))
if __name__ == '__main__':
Loading…
Cancel
Save