Created
          December 19, 2015 21:05 
        
      - 
      
 - 
        
Save tkellen/c3521685e4074b7b0099 to your computer and use it in GitHub Desktop.  
Revisions
- 
        
Tyler Kellen created this gist
Dec 19, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ #!/usr/bin/env python import sys import os try: import json except ImportError: import simplejson as json GROUP = os.environ.get('ANSIBLE_GROUP', 'all') HOST = os.environ.get('ANSIBLE_HOST') if HOST is None: raise Exception('Unable to generate inventory, ANSIBLE_HOST not present.') exit(1) inventory = {} inventory[GROUP] = {} inventory[GROUP]['hosts'] = [HOST] if (len(sys.argv) == 2 and sys.argv[1] == "--list"): print json.dumps(inventory, indent=2) else: print json.dumps({})