diff --git a/lib/ansible/cli/adhoc.py b/lib/ansible/cli/adhoc.py index d4f917f2c2..862bfd107d 100644 --- a/lib/ansible/cli/adhoc.py +++ b/lib/ansible/cli/adhoc.py @@ -74,9 +74,12 @@ class AdHocCLI(CLI): self.options, self.args = self.parser.parse_args(self.args[1:]) - if len(self.args) != 1: + if len(self.args) < 1: raise AnsibleOptionsError("Missing target hosts") + if len(self.args) > 1: + raise AnsibleOptionsError("Extranous options or arguments") + display.verbosity = self.options.verbosity self.validate_conflicts(runas_opts=True, vault_opts=True, fork_opts=True)