Date: 2020-11-25 23:53:05
Score: 4
Report link

Some updated information...

As Vladimir mentioned,

vars_files are read when the play starts. include_vars are read when the play reaches the task

Like all static items, vars_files are read before the play starts. Unlike include_vars, which are "included" when the play reaches it.

One of the biggest differences between static reuse and dynamic reuse is how the variables or tasks within them are processed. All static reuse items are processed with the linear strategy by default, all host stay in lockstep with each other. Each tasks has to complete on ALL hosts before the next task can begin. Hosts that are skipped actually get a noop task to process.

Dynamic reuse does not change the performance strategy from linear, however it does change the order the tasks are processed. With dynamic reuse, the entire group of tasks must complete on a single host before they are process by the next host. Unfortunately, all the other hosts get to twiddle their noops while they wait.

Include statements are good when you need to 'loop' a host through a series of tasks with registered outputs and do something with that information before the before the next host starts.

Import statements are good when you need to collect information or perform a task on a group of hosts before the next task can start for any host.

Here is a really good table that compares all the different Include_* and Import_* functions.Comparing includes and imports: dynamic and static re-use

Just as an FYI, here is a link to more information about performance strategies and how you can improve performance. How can I improve performance for network playbooks?

  • Blacklisted phrase (1.5): How can I
  • Long answer (-1):
  • No code block (0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: jlagermann