Joined October 2020
·

hakron

Stockholm, Sweden
·

Posted to Adding hooks to your Ansible roles over 1 year ago

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
Achievements
1 Karma
0 Total ProTip Views
Interests & Skills