Skip to content

Commit

Permalink
Fix systemd start on boot
Browse files Browse the repository at this point in the history
  • Loading branch information
gcdev373 committed Apr 12, 2024
1 parent 8bb4e5e commit 87914d6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
16 changes: 16 additions & 0 deletions stroom/roles/non_docker_proxy/systemd/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---

- name: Stop Stroom Proxy Service
# listen: Reload Stroom Proxy Service
become: true
become_user: root
systemd:
name: stroom-proxy
state: stopped

- name: Reload systemd Daemon
# listen: Reload Stroom Service
become: true
become_user: root
systemd:
daemon_reload: true
27 changes: 9 additions & 18 deletions stroom/roles/non_docker_proxy/systemd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@
- stroom_service_state is defined
- java_version is defined

- name: Stop Stroom Proxy Service if running
when: stroom_service_state is defined
become: true
become_user: root
when: stroom_proxy_service_installed is defined and stroom_proxy_service_installed.rc == 0
systemd:
name: stroom-proxy
state: stopped

- name: SystemD Service File
become: true
become_user: root
Expand All @@ -28,20 +19,20 @@
template:
src: "templates/etc/systemd/system/stroom-proxy.service.j2"
dest: "/etc/systemd/system/stroom-proxy.service"
notify:
- Stop Stroom Proxy Service
- Reload systemd Daemon

- name: SystemD Service enable
when: stroom_service_on_boot is defined
register: stroom_proxy_service_installed
become: true
become_user: root
systemd:
name: stroom-proxy
enabled: "{{ stroom_service_on_boot }}"
# Force the old service to stop prior to starting the new one
- name: Flush handlers
meta: flush_handlers

- name: SystemD Service start
- name: SystemD Service start/enable
when: stroom_service_state is defined
become: true
become_user: root
systemd:
name: stroom-proxy
state: "{{ stroom_service_state }}"
enabled: "{{ stroom_service_on_boot }}"

12 changes: 3 additions & 9 deletions stroom/roles/non_docker_stroom/systemd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,12 @@
- name: Flush handlers
meta: flush_handlers

- name: SystemD Service enable
when: stroom_service_on_boot is defined
become: true
become_user: root
systemd:
name: stroom
enabled: "{{ stroom_service_on_boot }}"

- name: SystemD Service start
- name: SystemD Service start/enable
when: stroom_service_state is defined
become: true
become_user: root
systemd:
name: stroom
state: "{{ stroom_service_state }}"
enabled: "{{ stroom_service_on_boot }}"

0 comments on commit 87914d6

Please sign in to comment.