Created
May 3, 2017 19:01
-
-
Save ioggstream/47bfda85d11c310b4c7b1aa0d466acb9 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/python | |
"""Get ips from nova hosts. Quick and dirty. | |
""" | |
from re import findall | |
from subprocess import check_output | |
from shlex import split | |
from json import dumps | |
def sh(cmd): | |
return check_output(split(cmd)) | |
print(dumps( | |
dict(databases= | |
dict(hosts= | |
findall(r'\b(192.168.\d+.\d+)\b', sh('openstack server list --format=csv')) | |
) | |
) | |
)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment