From 832b3ebea23ac91b95a0d074bbd1077488b5781e Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 16 Jan 2015 18:31:58 -0500 Subject: [PATCH] adds to v2 the ability to run with empty inventory (implicit localhost), which is now a warning and not an error. --- v2/bin/ansible-playbook | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/v2/bin/ansible-playbook b/v2/bin/ansible-playbook index e7a60939733..03392e13f90 100755 --- a/v2/bin/ansible-playbook +++ b/v2/bin/ansible-playbook @@ -15,6 +15,7 @@ from ansible.playbook.task import Task from ansible.utils.cli import base_parser from ansible.utils.vars import combine_vars from ansible.vars import VariableManager +from ansible.utils import warning #--------------------------------------------------------------------------------------------------- @@ -138,7 +139,7 @@ def main(args): inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=options.inventory) inventory.subset(options.subset) if len(inventory.list_hosts()) == 0: - raise AnsibleError("provided hosts list is empty") + warning("provided hosts list is empty, only localhost is available") # create the playbook executor, which manages running the plays # via a task queue manager