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
This commit is contained in:
zwarebear
2023-01-18 11:13:14 -06:00
parent 71e2f3ac9a
commit 883639f364

View File

@@ -27,6 +27,7 @@
owner: "{{ artifactory_user }}" owner: "{{ artifactory_user }}"
group: "{{ artifactory_group }}" group: "{{ artifactory_group }}"
creates: "{{ artifactory_untar_home }}" creates: "{{ artifactory_untar_home }}"
register: unarchived_artifactory
when: (download_artifactory is succeeded) and (not ansible_check_mode) when: (download_artifactory is succeeded) and (not ansible_check_mode)
- name: Stop artifactory - name: Stop artifactory
@@ -44,12 +45,12 @@
file: file:
path: "{{ artifactory_home }}/app" path: "{{ artifactory_home }}/app"
state: absent state: absent
when: download_artifactory.changed when: (download_artifactory.changed) or (unarchived_artifactory.changed)
- name: Copy new app to artifactory app - name: Copy new app to artifactory app
become: yes become: yes
command: "cp -r {{ artifactory_untar_home }}/app/. {{ artifactory_home }}/app" 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 notify: restart artifactory
- name: Configure artifactory license(s) - name: Configure artifactory license(s)
@@ -63,6 +64,12 @@
- artifactory_licenses | length > 0 - artifactory_licenses | length > 0
notify: restart artifactory 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 - name: Check if jdbc driver exists
become: yes become: yes
stat: stat:
@@ -79,6 +86,7 @@
when: when:
- postgres_driver_download_url is defined - postgres_driver_download_url is defined
- not database_driver.stat.exists - not database_driver.stat.exists
- not included_database_driver.stat.exists
notify: restart artifactory notify: restart artifactory
- name: Configure installer info - name: Configure installer info