Skip to content

Commit

Permalink
Updating the ANSIBLE_ROLES_PATH to allow role to be found (#173)
Browse files Browse the repository at this point in the history
* Updating the ANSIBLE_ROLES_PATH to allow role to be found

* Updating the ANSIBLE_ROLES_PATH to allow role to be found
  • Loading branch information
oybed authored Jun 22, 2022
1 parent 5fee5e3 commit 507b05d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion roles/openshift-applier/tasks/pre-post-step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,27 @@
loop_control:
loop_var: var

- set_fact:
saved_ansible_roles_path: "{{ lookup('env', 'ANSIBLE_ROLES_PATH') }}"

- name: "Add temporary path to the ANSIBLE_ROLES_PATH to let it find pre/post steps roles"
setup:
environment:
ANSIBLE_ROLES_PATH: "{{ tmp_dep_dir + ':' + saved_ansible_roles_path }}"

- name: "Include the pre/post step role"
include_role:
name: "{{ tmp_dep_dir }}{{ step.role }}"
name: "{{ step.role }}"
when:
- step is defined
- step.role is defined
- step.role|trim != ''

- name: "Restore ANSIBLE_ROLES_PATH to remove temporary location"
setup:
environment:
ANSIBLE_ROLES_PATH: "{{ saved_ansible_roles_path }}"

- name: "Clear facts to ensure that they don't carry over"
set_fact:
"{{ var.key }}": ""
Expand Down

0 comments on commit 507b05d

Please sign in to comment.