add freezelist script to list out frozen/not forzen hosts
This commit is contained in:
parent
284aad09bd
commit
cd911b2559
1 changed files with 29 additions and 0 deletions
29
scripts/freezelist
Executable file
29
scripts/freezelist
Executable 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue