From 3c9890a35893f63ff7ba61ba1795d3fa1fbaa8f6 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 8 Apr 2015 03:16:13 -0400 Subject: [PATCH] now in v2 everything passes a single passwords hash --- v2/ansible/executor/playbook_executor.py | 6 ++---- v2/bin/ansible-playbook | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/v2/ansible/executor/playbook_executor.py b/v2/ansible/executor/playbook_executor.py index 20aad364766..8af19ed378f 100644 --- a/v2/ansible/executor/playbook_executor.py +++ b/v2/ansible/executor/playbook_executor.py @@ -36,16 +36,14 @@ class PlaybookExecutor: basis for bin/ansible-playbook operation. ''' - # FIXME: passwords should not be passed in piecemeal like this, - # if they're just going to be stuck in a dict later. - def __init__(self, playbooks, inventory, variable_manager, loader, display, options, conn_pass, become_pass): + def __init__(self, playbooks, inventory, variable_manager, loader, display, options, passwords): self._playbooks = playbooks self._inventory = inventory self._variable_manager = variable_manager self._loader = loader self._display = display self._options = options - self.passwords = {'conn_pass': conn_pass, 'become_pass': become_pass} + self.passwords = passwords if options.listhosts or options.listtasks or options.listtags: self._tqm = None diff --git a/v2/bin/ansible-playbook b/v2/bin/ansible-playbook index 000a0b74c7a..d663e2e0a3f 100755 --- a/v2/bin/ansible-playbook +++ b/v2/bin/ansible-playbook @@ -66,6 +66,7 @@ def main(display, args): if not options.listhosts and not options.listtasks and not options.listtags: normalize_become_options(options) (sshpass, becomepass, vault_pass) = ask_passwords(options) + passwords = { 'conn_pass': sshpass, 'become_pass': becomepass } if options.vault_password_file: # read vault_pass from a file @@ -127,7 +128,7 @@ def main(display, args): raise errors.AnsibleError("Specified --limit does not match any hosts") # create the playbook executor, which manages running the plays via a task queue manager - pbex = PlaybookExecutor(playbooks=args, inventory=inventory, variable_manager=variable_manager, loader=loader, display=display, options=options, conn_pass=sshpass, become_pass=becomepass) + pbex = PlaybookExecutor(playbooks=args, inventory=inventory, variable_manager=variable_manager, loader=loader, display=display, options=options, passwords=passwords) results = pbex.run()