diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py index 7c20843925..5f6dfcc449 100644 --- a/lib/ansible/playbook/__init__.py +++ b/lib/ansible/playbook/__init__.py @@ -89,14 +89,15 @@ class Playbook: self._loader.set_basedir(cur_basedir) raise AnsibleParserError("playbook entries must be either a valid play or an include statement", obj=entry) - if 'include' in entry or 'import_playbook' in entry: + if any(action in entry for action in ('import_playbook', 'include')): if 'include' in entry: - display.deprecated("You should use 'import_playbook' instead of 'include' for playbook includes") + display.deprecated("'include' for playbook includes. You should use 'import_playbook' instead", version="2.8") pb = PlaybookInclude.load(entry, basedir=self._basedir, variable_manager=variable_manager, loader=self._loader) if pb is not None: self._entries.extend(pb._entries) else: - display.display("skipping playbook include '%s' due to conditional test failure" % entry.get('include', entry), color=C.COLOR_SKIP) + which = entry.get('import_playbook', entry.get('include', entry)) + display.display("skipping playbook '%s' due to conditional test failure" % which, color=C.COLOR_SKIP) else: entry_obj = Play.load(entry, variable_manager=variable_manager, loader=self._loader) self._entries.append(entry_obj)