diff --git a/bin/ansible-playbook b/bin/ansible-playbook index 13db4872dc..c0ad500d9d 100755 --- a/bin/ansible-playbook +++ b/bin/ansible-playbook @@ -68,6 +68,11 @@ def main(args): parser.print_help(file=sys.stderr) return 1 + 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 if not options.listhosts: