Last active
August 8, 2017 13:08
-
-
Save zahna/63783dba265269ea09a6c75e4d7bad62 to your computer and use it in GitHub Desktop.
initializing my ansible dynamic inventory data structure
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 characters
| # Initialize the inventory | |
| inventory = {} | |
| inventory['all'] = {'hosts': [], 'vars': {}} | |
| inventory['_meta'] = {'hostvars': {}} | |
| # Add localhost to inventory | |
| inventory['all']['hosts'].append('localhost') | |
| inventory['_meta']['hostvars']['localhost'] = {} | |
| inventory['_meta']['hostvars']['localhost']['ansible_host'] = 'localhost' | |
| inventory['_meta']['hostvars']['localhost']['ec2_public_dns_name'] = 'localhost' | |
| inventory['_meta']['hostvars']['localhost']['ec2_public_ip_address'] = '127.0.0.1' | |
| inventory['_meta']['hostvars']['localhost']['ec2_private_ip_address'] = '127.0.0.1' | |
| inventory['_meta']['hostvars']['localhost']['ansible_connection'] = 'local' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment