summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2014-07-07 14:16:37 -0500
committerJames Cammarata <jimi@sngx.net>2014-07-07 14:16:37 -0500
commitfe892fccb156e4dbe2f907a79d8293eed6f18f35 (patch)
tree52c8c61c7eb6b7e0da06b765f52308ac111f84fe /bin
parent11a5fc85f4e49000cb0d83b4272370f57556d587 (diff)
parentb0ff1ea425585ec16585ec6a7d2e676ed3c45430 (diff)
downloadansible-fe892fccb156e4dbe2f907a79d8293eed6f18f35.tar.gz
Merge remote-tracking branch 'svg/varsplugins_refactor' into svg_and_inventory_refactor
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ansible2
-rwxr-xr-xbin/ansible-playbook13
2 files changed, 6 insertions, 9 deletions
diff --git a/bin/ansible b/bin/ansible
index 1e2540fafb..7e767b2f7d 100755
--- a/bin/ansible
+++ b/bin/ansible
@@ -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)
diff --git a/bin/ansible-playbook b/bin/ansible-playbook
index d7c9182e2f..149a9f1c6e 100755
--- a/bin/ansible-playbook
+++ b/bin/ansible-playbook
@@ -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: