From 1802684c7b94cd323e573c5b89cc77e4e1552c83 Mon Sep 17 00:00:00 2001 From: Sandra McCann Date: Mon, 25 Apr 2022 11:44:31 -0400 Subject: [PATCH] add link to deprecation warning (#77599) * add link to deprecation warning (cherry picked from commit f991470dd0a8027be1bd2f2d3623a637d0a862ca) --- changelogs/fragments/77599-add-url-include-deprecation.yml | 2 ++ lib/ansible/playbook/helpers.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/77599-add-url-include-deprecation.yml diff --git a/changelogs/fragments/77599-add-url-include-deprecation.yml b/changelogs/fragments/77599-add-url-include-deprecation.yml new file mode 100644 index 00000000000..11e60f75979 --- /dev/null +++ b/changelogs/fragments/77599-add-url-include-deprecation.yml @@ -0,0 +1,2 @@ +bugfixes: + - include module - add docs url to include deprecation message (https://github.com/ansible/ansible/issues/76684). diff --git a/lib/ansible/playbook/helpers.py b/lib/ansible/playbook/helpers.py index 16873375f17..ee48ab160b2 100644 --- a/lib/ansible/playbook/helpers.py +++ b/lib/ansible/playbook/helpers.py @@ -95,6 +95,7 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h from ansible.playbook.role_include import IncludeRole from ansible.playbook.handler_task_include import HandlerTaskInclude from ansible.template import Templar + from ansible.utils.plugin_docs import get_versioned_doclink if not isinstance(ds, list): raise AnsibleAssertionError('The ds (%s) should be a list but was a %s' % (ds, type(ds))) @@ -155,7 +156,8 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h elif action in C._ACTION_IMPORT_TASKS: is_static = True else: - display.deprecated('"include" is deprecated, use include_tasks/import_tasks instead', "2.16") + include_link = get_versioned_doclink('user_guide/playbooks_reuse_includes.html') + display.deprecated('"include" is deprecated, use include_tasks/import_tasks instead. See %s for details' % include_link, "2.16") is_static = not templar.is_template(t.args['_raw_params']) and t.all_parents_static() and not t.loop if is_static: