diff options
author | James Cammarata <jimi@sngx.net> | 2014-07-07 21:16:37 +0200 |
---|---|---|
committer | James Cammarata <jimi@sngx.net> | 2014-07-07 21:16:37 +0200 |
commit | fe892fccb156e4dbe2f907a79d8293eed6f18f35 (patch) | |
tree | 52c8c61c7eb6b7e0da06b765f52308ac111f84fe /bin/ansible-playbook | |
parent | Merge branch 'inventory_refactoring' into svg_and_inventory_refactor (diff) | |
parent | performance optimisation in hash merge logic (diff) | |
download | ansible-fe892fccb156e4dbe2f907a79d8293eed6f18f35.tar.xz ansible-fe892fccb156e4dbe2f907a79d8293eed6f18f35.zip |
Merge remote-tracking branch 'svg/varsplugins_refactor' into svg_and_inventory_refactor
Diffstat (limited to 'bin/ansible-playbook')
-rwxr-xr-x | bin/ansible-playbook | 13 |
1 files changed, 5 insertions, 8 deletions
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: |