From 46e3665cd561cd0b4f0425ce0ff18b996b0fcab2 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 15 Oct 2019 10:50:48 +1100 Subject: [PATCH] ITOPSENG-164 Debug some changes to logic --- roles/product_install/tasks/main.yml | 72 +++++++++++++++------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/roles/product_install/tasks/main.yml b/roles/product_install/tasks/main.yml index 288b0f6..3665698 100644 --- a/roles/product_install/tasks/main.yml +++ b/roles/product_install/tasks/main.yml @@ -159,42 +159,46 @@ - completed_lock.stat.isdir is defined - completed_lock.stat.isdir -# If the binary was never installed, download it to temp location -- name: Installer not on home_shared. Fetch it. - get_url: - url: "{{ atl_product_download_url }}" - dest: "{{ atl_product_temp_download }}" - mode: 0755 - force: false - register: atl_product_completed +# Fetch binary if required +- name: download_binary is true so fetch and do all the things + block: + + - name: Fetch binary + get_url: + url: "{{ atl_product_download_url }}" + dest: "{{ atl_product_temp_download }}" + mode: 0755 + force: false + register: atl_product_completed + + # If product installer was fetched make the moving directory + - name: Create moving_lock. + file: + path: "{{ atl_product_home_shared_moving_lock }}" + state: directory + when: + - atl_product_completed is succeeded + register: moving_lock_created + + # Directory lock was created by this run + # - Move binary + - name: Move binary Scenario - lock created by this run + set_fact: + move_binary: true + when: + - moving_lock_created is succeeded + - moving_lock_created.changed == True + + # Directory lock was either already created or could not be + # - Continue and install from temp + - name: Continue Scenario - lock cannot be created or created by previous run + debug: + msg: lock not created + when: moving_lock_created is not succeeded or + ( moving_lock_created is succeeded and moving_lock_created.changed == False ) + when: download_binary -# If product installer was fetched make the moving directory -- name: Create moving_lock. - file: - path: "{{ atl_product_home_shared_moving_lock }}" - state: directory - when: - - atl_product_completed is succeeded - register: moving_lock_created - -# Directory lock was created by this run -# - Move binary -- name: Move binary Scenario - lock created by this run - set_fact: - move_binary: true - when: - - moving_lock_created is succeeded - - moving_lock_created.changed == True - -# Directory lock was either already created or could not be -# - Continue and install from temp -- name: Continue Scenario - lock cannot be created or created by previous run - debug: - msg: lock not created - when: moving_lock_created is not succeeded or - ( moving_lock_created is succeeded and moving_lock_created.changed == False ) - # Move binary block - name: Move product installer to home_shared