Last active
March 17, 2022 00:06
-
-
Save jctanner/8035026 to your computer and use it in GitHub Desktop.
large fake inventory
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
$ cat ./0000-travis-accelerate-keys/makeinventory.py | |
#!/usr/bin/python | |
import os | |
import sys | |
import string | |
import epdb | |
import json | |
extra_data = " ansible_ssh_user=root ansible_ssh_host=192.168.1.148" | |
check_host = None | |
if len(sys.argv) > 1: | |
if sys.argv[1] == "--host": | |
check_host = sys.argv[2] | |
inventory = {} | |
inventory['all'] = {} | |
inventory['all']['hosts'] = [] | |
inventory['all']['vars'] = {} | |
inventory['all']['vars']['ansible_ssh_user'] = "root" | |
inventory['all']['vars']['ansible_ssh_host'] = "192.168.1.148" | |
if check_host is None: | |
for char1 in string.lowercase: | |
for char2 in string.lowercase: | |
for char3 in string.lowercase: | |
thishost = char1 + char2 + char3 | |
inventory['all']['hosts'].append(thishost) | |
print json.dumps(inventory) | |
else: | |
inventory['all']['hosts'].append(check_host) | |
print json.dumps(inventory['all']['vars']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment