File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 22
33- name : Run pre.yml hook
44 vars :
5- appliances_environment_root : " {{ lookup('env', 'APPLIANCES_ENVIRONMENT_ROOT') }}"
5+ # hostvars not available here, so have to recalculate environment root:
6+ appliances_environment_root : " {{ ansible_inventory_sources | last | dirname }}"
67 hook_path : " {{ appliances_environment_root }}/hooks/pre.yml"
78 import_playbook : " {{ hook_path if hook_path | exists else 'noop.yml' }}"
89 when : hook_path | exists
1415
1516- name : Run post-bootstrap.yml hook
1617 vars :
17- appliances_environment_root : " {{ lookup('env', 'APPLIANCES_ENVIRONMENT_ROOT') }}"
18+ # hostvars not available here, so have to recalculate environment root:
19+ appliances_environment_root : " {{ ansible_inventory_sources | last | dirname }}"
1820 hook_path : " {{ appliances_environment_root }}/hooks/post-bootstrap.yml"
1921 import_playbook : " {{ hook_path if hook_path | exists else 'noop.yml' }}"
2022 when : hook_path | exists
2830
2931- name : Run post.yml hook
3032 vars :
31- appliances_environment_root : " {{ lookup('env', 'APPLIANCES_ENVIRONMENT_ROOT') }}"
33+ # hostvars not available here, so have to recalculate environment root:
34+ appliances_environment_root : " {{ ansible_inventory_sources | last | dirname }}"
3235 hook_path : " {{ appliances_environment_root }}/hooks/post.yml"
3336 import_playbook : " {{ hook_path if hook_path | exists else 'noop.yml' }}"
3437 when : hook_path | exists
Original file line number Diff line number Diff line change 11---
22
3+ - name : debug
4+ hosts :
5+ - localhost
6+ - openstack
7+ become : no
8+ gather_facts : no
9+ tasks :
10+ - debug :
11+ msg : " Starting pre-hook"
12+
313# Provision the infrastructure using Terraform
414- name : Provision infrastructure
515 hosts : openstack
You can’t perform that action at this time.
0 commit comments