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

Question: Rationale for notify: -nexus-service-stop in task Download nexus_package #406

Open
bzakdd opened this issue Jan 18, 2024 · 0 comments

Comments

@bzakdd
Copy link

bzakdd commented Jan 18, 2024

Hello!
I have a question regarding following task:

- name: Download nexus_package
  ansible.builtin.get_url:
    url: "{{ nexus_download_url }}/{{ nexus_package }}"
    dest: "{{ nexus_download_dir }}/{{ nexus_package }}"
    force: false
    validate_certs: "{{ nexus_download_ssl_verify | default(omit) }}"
    owner: root
    group: root
    mode: "0644"
  check_mode: false
  register: download_status
  until: download_status.status_code == 200
  retries: "{{ nexus_download_retries }}"
  delay: "{{ nexus_download_delay }}"
  notify:
    - nexus-service-stop

Why is notify: - nexus-service-stop here? I don't see the need to restart Nexus if only it's package was downloaded. True change happens when unpacking Nexus:

- name: Unpack Nexus download
  ansible.builtin.unarchive:
    src: "{{ nexus_download_dir }}/{{ nexus_package }}"
    dest: "{{ nexus_installation_dir }}"
    creates: "{{ nexus_installation_dir }}/nexus-{{ nexus_version }}"
    copy: false
    mode: "0755"
  notify:
    - nexus-service-stop

So which triggers nexus-service-stop by itself if it changes.


Furthermore I encountered case, when this (in my opinion useless notify: - nexus-service-stop) restarts Nexus needlessly:

  • I created a Nexus and left it running for a longer time
    • I didn't set nexus_download_dir so tarball got saved to /tmp
  • After a while tarball got wiped from /tmp.
  • I run playbook again to apply some minor changes in repositories and unexpectedly it restarts Nexus (since Download nexus_package task state is "changed")

If notify: - nexus-service-stop has no purpose in task - name: Download nexus_package task, then I'd consider removing it.

If you agree, I can create a PR.

@bzakdd bzakdd changed the title Question: Rationale for notify: -nexus-service-stop in task Download nexus_package Question: Rationale for notify: -nexus-service-stop in task Download nexus_package Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant