![]() ![]() When: not _file_executed | default(False) UPD A possibly useful trick to create a task file that can be imported many times, but executed only once: - name. Or hopefully I'll find a way to make it work. Maybe there won't be any in my playbooks. I decided to experience all those tricky edge cases first-hand. But I decided to switch to imports everywhere except for the cases where I need loops. I could probably switch to only includes. I can't use only imports, since I occasionally need loops. I mean, mixing includes and imports is not recommended. And it's still not clear if it'll protect me from troubles. I had a policy to start with imports, but once I needed an include I made sure nothing is imported by the included file or its children. So, no importing task files that change variables used in the import task's when attribute. Imports would certainly fail in cases like this: # playbook.ymlĭebug is not executed, since it inherits when from the import_tasks task. you cannot use -start-at-task to begin execution at a task inside a dynamic includeįor me that basically comes down to the fact that imports can't be used with the loop attribute.you cannot use notify to trigger a handler name which comes from inside a dynamic include.-list-tasks doesn't show tasks from included files.-list-tags doesn't show tags from included files.can't import a file, which name depends on a variable.can't be used with with_* or loop attributes.Only tagged tasks from an included file get executed if an include task is tagged. No tasks is executed from an included file if an include task is untagged.Īll tasks from an imported file get executed if an import task is tagged. Tagged tasks from an imported file get executed if an import task is untagged. tags and when of an included task apply only to the task itself. So, attributes like tags, and when (and most likely the rest) are copied to every imported task. Imports basically replace the task with the tasks from the file. Imports happen at parsing time, includes at runtime. Imports are static, includes are dynamic. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |