mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Merge pull request #1628 from dagwieers/fail-on-empty-host_list
Fail ansible-playbook when the hosts list (with applied subset) is empty
This commit is contained in:
@@ -68,6 +68,11 @@ def main(args):
|
|||||||
parser.print_help(file=sys.stderr)
|
parser.print_help(file=sys.stderr)
|
||||||
return 1
|
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
|
sshpass = None
|
||||||
sudopass = None
|
sudopass = None
|
||||||
if not options.listhosts:
|
if not options.listhosts:
|
||||||
|
|||||||
Reference in New Issue
Block a user