fix freezelist script for new ansible
Signed-off-by: Ricky Elrod <codeblock@fedoraproject.org>
This commit is contained in:
parent
b48ecff9f3
commit
a8209d03bb
1 changed files with 7 additions and 13 deletions
|
@ -9,30 +9,24 @@ import sys
|
|||
from optparse import OptionParser
|
||||
|
||||
from ansible.parsing.dataloader import DataLoader
|
||||
from ansible.vars import VariableManager
|
||||
from ansible.inventory import Inventory
|
||||
from ansible.vars.manager import VariableManager
|
||||
from ansible.inventory.manager import InventoryManager
|
||||
from ansible import constants as C
|
||||
|
||||
|
||||
parser = OptionParser(version="1.0")
|
||||
parser.add_option('-i', dest='inventory', default=None,
|
||||
parser.add_option('-i', dest='inventory', default=C.DEFAULT_HOST_LIST,
|
||||
help="Path to inventory file/dir")
|
||||
opts, args = parser.parse_args(sys.argv[1:])
|
||||
|
||||
variable_manager = VariableManager()
|
||||
loader = DataLoader()
|
||||
|
||||
|
||||
if opts.inventory:
|
||||
inv = Inventory(loader=loader,variable_manager=variable_manager, host_list=opts.inventory)
|
||||
else:
|
||||
inv = Inventory(loader=loader,variable_manager=variable_manager)
|
||||
|
||||
variable_manager.set_inventory(inv)
|
||||
inv = InventoryManager(loader=loader, sources=opts.inventory)
|
||||
variable_manager = VariableManager(loader=loader, inventory=inv)
|
||||
|
||||
frozen = []
|
||||
unfrozen = []
|
||||
for host in sorted(inv.get_hosts()):
|
||||
vars = variable_manager.get_vars(loader=loader, host=host)
|
||||
vars = variable_manager.get_vars(host=host)
|
||||
freezes = vars.get('freezes', None)
|
||||
|
||||
if freezes:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue