Excellent idea. My approach was to have only the variable in the include statement, no default, and then instead have a when condition to enable the inclusion only when the variable is defined. This hook in our generic deployment flow saved the day for one of my colleagues today.
- name: Run tasks pointed at by pre_start_hook if defined
include: "{{ pre_start_hook }}"
when: pre_start_hook is defined
Excellent idea. My approach was to have only the variable in the include statement, no default, and then instead have a when condition to enable the inclusion only when the variable is defined. This hook in our generic deployment flow saved the day for one of my colleagues today.