Skip to content

Commit

Permalink
Run Handlers When Services Should Exist (#280)
Browse files Browse the repository at this point in the history
* The `rke2-*` services might not exist so make sure to check if they should be there prior to trying to reset them.
* `rke2_installed_version` is not defined prior to use. default it to an empty string.
  • Loading branch information
timway authored Feb 12, 2025
1 parent b1ea650 commit b1bd831
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion roles/rke2/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

- name: Restart systemd-sysctl
ansible.builtin.service:
state: restarted
Expand All @@ -22,6 +21,7 @@
throttle: 1
when:
- not rke2_reboot
- ("rke2_servers" in group_names)

- name: Restart rke2-agent
ansible.builtin.service:
Expand All @@ -31,6 +31,7 @@
throttle: 1
when:
- not rke2_reboot
- ("rke2_agents" in group_names)

- name: Reload NetworkManager
ansible.builtin.systemd:
Expand Down
2 changes: 1 addition & 1 deletion roles/rke2/tasks/tarball_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
when:
- rke2_install_local_tarball_path == ""
- rke2_install_tarball_url == ""
- not rke2_installed or rke2_installed_version != rke2_full_version
- not rke2_installed or rke2_installed_version | default("") != rke2_full_version

- name: Send provided tarball from local control machine if available
ansible.builtin.copy:
Expand Down

0 comments on commit b1bd831

Please sign in to comment.