Skip to content
Steve Brasier edited this page Jul 1, 2021 · 31 revisions

Use a hook from a parent environment

Hooks from parent environment's don't get run by default as site.yml relies on APPLIANCES_ENVIRONMENT_ROOT to find them. But you can explicitly run them using :

# environments/child/hooks/pre/yml
- name: Import parent hook
  vars:
    appliances_environment_root: "{{ lookup('env', 'APPLIANCES_ENVIRONMENT_ROOT') }}"
  import_playbook: "{{ appliances_environment_root }}/../parent/hooks/pre.yml"

where child and parent are the environment names.

Clone this wiki locally