From 5ea238912fd68f008f9154f0379535b5fbb3730c Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Wed, 5 Sep 2018 13:08:09 -0500 Subject: [PATCH] [stable-2.5] Don't allow import_tasks to transition to dynamic when file is missing. See #44822 (#44836) (#44854) * [stable-2.5] Don't allow import_tasks to transition to dynamic when file is missing. See #44822 (#44836) (cherry picked from commit cd2f66f) Co-authored-by: Matt Martz * Look in task_ds, as we don't have action var in 2.5 --- changelogs/fragments/no-dynamic-import-tasks.yaml | 2 ++ lib/ansible/playbook/helpers.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/no-dynamic-import-tasks.yaml diff --git a/changelogs/fragments/no-dynamic-import-tasks.yaml b/changelogs/fragments/no-dynamic-import-tasks.yaml new file mode 100644 index 00000000000..b1bab23e9c0 --- /dev/null +++ b/changelogs/fragments/no-dynamic-import-tasks.yaml @@ -0,0 +1,2 @@ +minor_changes: +- import_tasks - Do not allow import_tasks to transition to dynamic if the file is missing (https://github.com/ansible/ansible/issues/44822) diff --git a/lib/ansible/playbook/helpers.py b/lib/ansible/playbook/helpers.py index 248a840bb05..f054138bc02 100644 --- a/lib/ansible/playbook/helpers.py +++ b/lib/ansible/playbook/helpers.py @@ -227,7 +227,7 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h # nested includes, and we want the include order printed correctly display.vv("statically imported: %s" % include_file) except AnsibleFileNotFound: - if t.static or \ + if 'include' not in task_ds or t.static or \ C.DEFAULT_TASK_INCLUDES_STATIC or \ C.DEFAULT_HANDLER_INCLUDES_STATIC and use_handlers: raise