Skip to content

Instantly share code, notes, and snippets.

@qrtt1
Last active August 29, 2015 14:11
Show Gist options
  • Save qrtt1/add290916ebc9c7b63d8 to your computer and use it in GitHub Desktop.
Save qrtt1/add290916ebc9c7b63d8 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import json
import sys
inventory = {}
inventory['www'] = {}
inventory['www']['hosts'] = ['aaa.bbb.ccc.ddd']
if "--host" in sys.argv:
if "aaa.bbb.ccc.ddd" in sys.argv:
print json.dumps({'ansible_ssh_user': 'user', 'ansible_ssh_private_key_file': '/home/user/.ssh/user_common.pem'})
else:
print json.dumps({})
else:
print json.dumps(inventory)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment