Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle case when install zipfile root is not expected #73

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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