From 917b6b0d0938b35790fc9467c3fa82b968fbd182 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 23 Jul 2018 00:48:40 -0400 Subject: [PATCH] import_playbook is not usable from inside a play (cherry picked from commit 55dddf530ad094810929823f80c4546e97a69ac7) --- lib/ansible/cli/adhoc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/cli/adhoc.py b/lib/ansible/cli/adhoc.py index 437687cf8c9..40026ff851d 100644 --- a/lib/ansible/cli/adhoc.py +++ b/lib/ansible/cli/adhoc.py @@ -134,6 +134,10 @@ class AdHocCLI(CLI): err = err + ' (did you mean to run ansible-playbook?)' raise AnsibleOptionsError(err) + # Avoid modules that don't work with ad-hoc + if self.options.module_name in ('import_playbook',): + raise AnsibleOptionsError("'%s' is not a valid action for ad-hoc commands" % self.options.module_name) + play_ds = self._play_ds(pattern, self.options.seconds, self.options.poll_interval) play = Play().load(play_ds, variable_manager=variable_manager, loader=loader)