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 2
2
3
3
- name : Run pre.yml hook
4
4
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 }}"
6
7
hook_path : " {{ appliances_environment_root }}/hooks/pre.yml"
7
8
import_playbook : " {{ hook_path if hook_path | exists else 'noop.yml' }}"
8
9
when : hook_path | exists
14
15
15
16
- name : Run post-bootstrap.yml hook
16
17
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 }}"
18
20
hook_path : " {{ appliances_environment_root }}/hooks/post-bootstrap.yml"
19
21
import_playbook : " {{ hook_path if hook_path | exists else 'noop.yml' }}"
20
22
when : hook_path | exists
28
30
29
31
- name : Run post.yml hook
30
32
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 }}"
32
35
hook_path : " {{ appliances_environment_root }}/hooks/post.yml"
33
36
import_playbook : " {{ hook_path if hook_path | exists else 'noop.yml' }}"
34
37
when : hook_path | exists
Original file line number Diff line number Diff line change 1
1
---
2
2
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
+
3
13
# Provision the infrastructure using Terraform
4
14
- name : Provision infrastructure
5
15
hosts : openstack
You can’t perform that action at this time.
0 commit comments