From 883639f364f1b79e52d6c943fea1924ea07f53d7 Mon Sep 17 00:00:00 2001 From: zwarebear <12432678+ZwareBear@users.noreply.github.com> Date: Wed, 18 Jan 2023 11:13:14 -0600 Subject: [PATCH] Ansible/Artifactory - Improve offline upgrades Improve play to better handle nodes without internet access. By pinning tasks to occur when the tar is downloaded or unarchived it allows for more coverage of scenarios. Similarly, check to see if the jdbc driver provided as part of the tar is the version set in the variables. This allows for users to provide the tar in presteps to calling the role if they choose / need to. Zachary.Wayer@garmin.com --- .../platform/roles/artifactory/tasks/upgrade.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Ansible/ansible_collections/jfrog/platform/roles/artifactory/tasks/upgrade.yml b/Ansible/ansible_collections/jfrog/platform/roles/artifactory/tasks/upgrade.yml index fe38c82..f017bf0 100644 --- a/Ansible/ansible_collections/jfrog/platform/roles/artifactory/tasks/upgrade.yml +++ b/Ansible/ansible_collections/jfrog/platform/roles/artifactory/tasks/upgrade.yml @@ -27,6 +27,7 @@ owner: "{{ artifactory_user }}" group: "{{ artifactory_group }}" creates: "{{ artifactory_untar_home }}" + register: unarchived_artifactory when: (download_artifactory is succeeded) and (not ansible_check_mode) - name: Stop artifactory @@ -44,12 +45,12 @@ file: path: "{{ artifactory_home }}/app" state: absent - when: download_artifactory.changed + when: (download_artifactory.changed) or (unarchived_artifactory.changed) - name: Copy new app to artifactory app become: yes command: "cp -r {{ artifactory_untar_home }}/app/. {{ artifactory_home }}/app" - when: download_artifactory.changed + when: (download_artifactory.changed) or (unarchived_artifactory.changed) notify: restart artifactory - name: Configure artifactory license(s) @@ -59,10 +60,16 @@ dest: "{{ artifactory_home }}/var/etc/artifactory/artifactory.cluster.license" mode: 0644 when: - - artifactory_licenses is defined - - artifactory_licenses | length > 0 + - artifactory_licenses is defined + - artifactory_licenses | length > 0 notify: restart artifactory +- name: Check if included database driver is the correct version + become: yes + stat: + path: "{{ artifactory_home }}/app/artifactory/tomcat/lib/postgresql-{{ postgres_driver_version }}.jar" + register: included_database_driver + - name: Check if jdbc driver exists become: yes stat: @@ -79,6 +86,7 @@ when: - postgres_driver_download_url is defined - not database_driver.stat.exists + - not included_database_driver.stat.exists notify: restart artifactory - name: Configure installer info