From b6b476de039e5e0137fb447bb1bd142f416b5ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Wed, 5 Sep 2018 14:42:06 +0200 Subject: [PATCH] Clean up previous osa inventory dir before deployment Since we're now pointing to an inventory directory instead of inventory file, it is possible that, in certain condition such as when modifying the roles, the inventory files from the previous deployment conflict with current one. To prevent any issue, let's delete the inventory directory prior to the deployment so that only the newly generated inventory files are present. Change-Id: I3e8d0d369c2ed5cac167f2958eddcb29f09eafa5 --- extraconfig/services/openshift-master.yaml | 19 +++++++++++++++++-- extraconfig/services/openshift-node.yaml | 11 ++--------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/extraconfig/services/openshift-master.yaml b/extraconfig/services/openshift-master.yaml index c3694d65bd..0519d15f53 100644 --- a/extraconfig/services/openshift-master.yaml +++ b/extraconfig/services/openshift-master.yaml @@ -116,8 +116,23 @@ outputs: external_deploy_tasks: list_concat: - get_attr: [OpenShiftNode, role_data, external_deploy_tasks] - - - name: openshift_master step 2 - when: step == '2' + - - name: openshift_master step 1 + when: step == '1' + tags: openshift + block: + # NOTE(mandre) Remove inventory directory as it may contain + # obsolete files that can mess up the current deployment + - name: remove inventory directory if it exists + file: + path: "{{playbook_dir}}/openshift/inventory" + state: absent + - name: create openshift inventory directory + file: + path: "{{playbook_dir}}/openshift/inventory" + state: directory + + - name: openshift_master step 3 + when: step == '3' tags: openshift block: - name: set openshift global vars fact diff --git a/extraconfig/services/openshift-node.yaml b/extraconfig/services/openshift-node.yaml index 913ff63659..3ff1df84ae 100644 --- a/extraconfig/services/openshift-node.yaml +++ b/extraconfig/services/openshift-node.yaml @@ -68,17 +68,10 @@ outputs: upgrade_tasks: [] step_config: '' external_deploy_tasks: - - name: openshift_node step 1 - when: step == '1' + - name: openshift_node step 2 + when: step == '2' tags: openshift block: - - name: create openshift temp dirs - file: - path: "{{item}}" - state: directory - with_items: - - "{{playbook_dir}}/openshift/inventory" - - name: set role facts for generating inventory set_fact: tripleo_role_name: {get_param: RoleName}