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 }}"
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