add freezelist script to list out frozen/not forzen hosts

This commit is contained in:
Seth Vidal 2013-05-14 14:47:59 +00:00
parent 284aad09bd
commit cd911b2559

29
scripts/freezelist Executable file
View file

@ -0,0 +1,29 @@
import ansible.inventory
import sys
inv = ansible.inventory.Inventory()
frozen = []
unfrozen = []
for host in sorted(inv.get_hosts()):
vars = inv.get_variables(host.name)
freezes = vars.get('freezes', None)
if freezes:
frozen.append(host.name)
elif freezes == 'None':
print 'Error: missing freeezes: %s' % host.name
else:
unfrozen.append(host.name)
print 'freeze:'
for host in frozen:
print ' ' + host
print 'do not freeze:'
for host in unfrozen:
print ' ' + host