Skip to content

Commit

Permalink
Merge pull request #73 from guidograzioli/amq_7_11_installdir
Browse files Browse the repository at this point in the history
Handle case when install zipfile root is not expected
  • Loading branch information
guidograzioli authored May 22, 2023
2 parents 40d7999 + 6f11a61 commit 78a67e7
Showing 1 changed file with 31 additions and 12 deletions.
43 changes: 31 additions & 12 deletions roles/activemq/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,39 @@
register: path_to_workdir
become: yes

- name: "Extract {{ activemq.name }} archive on target"
ansible.builtin.unarchive: # noqa no-handler definitely not a candidate for a handler
remote_src: yes
src: "{{ archive }}"
dest: "{{ activemq_dest }}"
creates: "{{ activemq.home }}"
owner: "{{ activemq_service_user }}"
group: "{{ activemq_service_group }}"
become: yes
register: new_version_extracted
- name: "Extract zipfile"
when:
- new_version_downloaded.changed or not path_to_workdir.stat.exists
notify:
- restart amq_broker
block:
- name: "Extract {{ activemq.name }} archive on target"
ansible.builtin.unarchive: # noqa no-handler definitely not a candidate for a handler
remote_src: yes
src: "{{ archive }}"
dest: "{{ activemq_dest }}"
owner: "{{ activemq_service_user }}"
group: "{{ activemq_service_group }}"
list_files: yes
become: yes
register: new_version_extracted
when:
- new_version_downloaded.changed or not path_to_workdir.stat.exists
notify:
- restart amq_broker

- name: "Check target directory: {{ activemq.home }}"
ansible.builtin.stat:
path: "{{ activemq.home }}"
register: path_to_workdir_after_extract
become: yes

- name: Link zipfile directory to wanted directory
become: yes
ansible.builtin.file:
state: link
src: "{{ activemq_dest }}/{{ new_version_extracted.files | first }}"
dest: "{{ activemq.home }}"
when:
- not path_to_workdir_after_extract.stat.exists

- name: Inform decompression was not executed
ansible.builtin.debug: # noqa no-handler definitely not a candidate for a handler
Expand Down

0 comments on commit 78a67e7

Please sign in to comment.