mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-30 04:49:09 -07:00
started implementing 'list options'
This commit is contained in:
parent
2ade17e2f5
commit
20b4492704
1 changed files with 17 additions and 4 deletions
|
@ -58,13 +58,16 @@ def main(args):
|
||||||
|
|
||||||
validate_conflicts(parser,options)
|
validate_conflicts(parser,options)
|
||||||
|
|
||||||
|
# Note: slightly wrong, this is written so that implicit localhost
|
||||||
# Manage passwords
|
# Manage passwords
|
||||||
sshpass = None
|
sshpass = None
|
||||||
becomepass = None
|
becomepass = None
|
||||||
vault_pass = None
|
vault_pass = None
|
||||||
|
|
||||||
normalize_become_options(options)
|
# don't deal with privilege escalation when we don't need to
|
||||||
(sshpass, becomepass, vault_pass) = ask_passwords(options)
|
if not options.listhosts and not options.listtasks and not options.listtags:
|
||||||
|
normalize_become_options(options)
|
||||||
|
(sshpass, becomepass, vault_pass) = ask_passwords(options)
|
||||||
|
|
||||||
if options.vault_password_file:
|
if options.vault_password_file:
|
||||||
# read vault_pass from a file
|
# read vault_pass from a file
|
||||||
|
@ -109,7 +112,6 @@ def main(args):
|
||||||
inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=options.inventory)
|
inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=options.inventory)
|
||||||
variable_manager.set_inventory(inventory)
|
variable_manager.set_inventory(inventory)
|
||||||
|
|
||||||
# Note: slightly wrong, this is written so that implicit localhost
|
|
||||||
# (which is not returned in list_hosts()) is taken into account for
|
# (which is not returned in list_hosts()) is taken into account for
|
||||||
# warning if inventory is empty. But it can't be taken into account for
|
# warning if inventory is empty. But it can't be taken into account for
|
||||||
# checking if limit doesn't match any hosts. Instead we don't worry about
|
# checking if limit doesn't match any hosts. Instead we don't worry about
|
||||||
|
@ -129,7 +131,18 @@ def main(args):
|
||||||
# create the playbook executor, which manages running the plays
|
# create the playbook executor, which manages running the plays
|
||||||
# via a task queue manager
|
# via a task queue manager
|
||||||
pbex = PlaybookExecutor(playbooks=args, inventory=inventory, variable_manager=variable_manager, loader=loader, options=options)
|
pbex = PlaybookExecutor(playbooks=args, inventory=inventory, variable_manager=variable_manager, loader=loader, options=options)
|
||||||
return pbex.run()
|
|
||||||
|
if options.listhosts:
|
||||||
|
print('TODO: implement')
|
||||||
|
sys.exit(0)
|
||||||
|
elif options.listtasks:
|
||||||
|
print('TODO: implement')
|
||||||
|
sys.exit(0)
|
||||||
|
elif options.listtags:
|
||||||
|
print('TODO: implement')
|
||||||
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
return pbex.run()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
#display(" ", log_only=True)
|
#display(" ", log_only=True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue