mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-03 23:14:02 -07:00
Merge remote-tracking branch 'svg/varsplugins_refactor' into svg_and_inventory_refactor
This commit is contained in:
commit
fe892fccb1
7 changed files with 299 additions and 231 deletions
|
@ -136,7 +136,7 @@ class Cli(object):
|
|||
if not options.ask_vault_pass:
|
||||
vault_pass = tmp_vault_pass
|
||||
|
||||
inventory_manager = inventory.Inventory(options.inventory)
|
||||
inventory_manager = inventory.Inventory(options.inventory, vault_password=vault_pass)
|
||||
if options.subset:
|
||||
inventory_manager.subset(options.subset)
|
||||
hosts = inventory_manager.list_hosts(pattern)
|
||||
|
|
|
@ -100,11 +100,6 @@ def main(args):
|
|||
if (options.ask_vault_pass and options.vault_password_file):
|
||||
parser.error("--ask-vault-pass and --vault-password-file are mutually exclusive")
|
||||
|
||||
inventory = ansible.inventory.Inventory(options.inventory)
|
||||
inventory.subset(options.subset)
|
||||
if len(inventory.list_hosts()) == 0:
|
||||
raise errors.AnsibleError("provided hosts list is empty")
|
||||
|
||||
sshpass = None
|
||||
sudopass = None
|
||||
su_pass = None
|
||||
|
@ -160,12 +155,14 @@ def main(args):
|
|||
if not (os.path.isfile(playbook) or stat.S_ISFIFO(os.stat(playbook).st_mode)):
|
||||
raise errors.AnsibleError("the playbook: %s does not appear to be a file" % playbook)
|
||||
|
||||
inventory = ansible.inventory.Inventory(options.inventory, vault_password=vault_pass)
|
||||
inventory.subset(options.subset)
|
||||
if len(inventory.list_hosts()) == 0:
|
||||
raise errors.AnsibleError("provided hosts list is empty")
|
||||
|
||||
# run all playbooks specified on the command line
|
||||
for playbook in args:
|
||||
|
||||
# let inventory know which playbooks are using so it can know the basedirs
|
||||
inventory.set_playbook_basedir(os.path.dirname(playbook))
|
||||
|
||||
stats = callbacks.AggregateStats()
|
||||
playbook_cb = callbacks.PlaybookCallbacks(verbose=utils.VERBOSITY)
|
||||
if options.step:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue