1
0
mirror of https://github.com/ansible/tower-cli.git synced 2026-02-06 00:48:50 +01:00
Files
tower-cli/docs/source/cli_ref/examples/inventory_script_example.py
2018-03-16 16:03:10 -04:00

18 lines
327 B
Python
Executable File

#!/usr/bin/env python
import json
inv = {
'_meta': {
'hostvars': {}
},
'hosts': []
}
for num in range(0, 3):
host = u"host-%0.2d" % num
inv['hosts'].append(host)
inv['_meta']['hostvars'][host] = dict(ansible_ssh_host='127.0.0.1', ansible_connection='local')
print(json.dumps(inv, indent=2))