mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-05-16 13:56:03 +08:00
add freezelist script to list out frozen/not forzen hosts
This commit is contained in:
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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user