From 532cec4d3ec82b5ef4ab17db0c867e1e4a6ceac3 Mon Sep 17 00:00:00 2001 From: dave-belton Date: Tue, 21 Jan 2025 10:00:38 +0000 Subject: [PATCH] DBA-844 (#504) Commit Description: Refactor Alfresco Wallet Role Inclusion to Use include_role Summary of Change: Replaced the roles section for the alfresco_wallet role in playbooks/delius-artefacts-playbook.yml with a task that uses the include_role module. This ensures the role is conditionally included at runtime based on the deploy_alfresco_wallet variable. Reason for Change: Ansible pre-checks for the existence of roles in the roles section, even when they are conditionally included. This caused errors in workflows (e.g., oracle-db-mis-configuration-artefacts.yml) where the alfresco_wallet role was not needed and its directory did not exist. Using include_role delays role inclusion until the when condition is evaluated, avoiding the unnecessary pre-check and error. --- playbooks/delius-artefacts-playbook.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/playbooks/delius-artefacts-playbook.yml b/playbooks/delius-artefacts-playbook.yml index 3b8877a7..46fad6bf 100644 --- a/playbooks/delius-artefacts-playbook.yml +++ b/playbooks/delius-artefacts-playbook.yml @@ -87,5 +87,8 @@ gather_facts: no become: yes become_user: oracle - roles: - - { role: "{{ playbook_dir }}/alfresco_wallet/alfresco_wallet", when: ( deploy_alfresco_wallet | default('no') == "yes" ) } + tasks: + - name: Deploy Alfresco Wallet + include_role: + name: "{{ playbook_dir }}/alfresco_wallet/alfresco_wallet" + when: deploy_alfresco_wallet | default('no') == "yes"