laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ci/+/43206?usp=email )

Change subject: ansible: obsworker: restart on failure
......................................................................

ansible: obsworker: restart on failure

The obsworker service can fail if it can't reach the OBS server after it
started. Let it retry continuously until the server comes up again.

As the original service is of type "oneshot", Restart=on-failure must be
used instead of Restart=always (https://unix.stackexchange.com/a/777329).

Change-Id: I81fe02984d6c227a482b0b2421a967def1e208d5
---
A ansible/roles/osmocom-obs-worker/files/obsworker.conf
M ansible/roles/osmocom-obs-worker/tasks/obs.yml
2 files changed, 12 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved




diff --git a/ansible/roles/osmocom-obs-worker/files/obsworker.conf 
b/ansible/roles/osmocom-obs-worker/files/obsworker.conf
new file mode 100644
index 0000000..cb9a4dd
--- /dev/null
+++ b/ansible/roles/osmocom-obs-worker/files/obsworker.conf
@@ -0,0 +1,3 @@
+[Service]
+Restart=on-failure
+RestartSec=10
diff --git a/ansible/roles/osmocom-obs-worker/tasks/obs.yml 
b/ansible/roles/osmocom-obs-worker/tasks/obs.yml
index 48024ec..f13195a 100644
--- a/ansible/roles/osmocom-obs-worker/tasks/obs.yml
+++ b/ansible/roles/osmocom-obs-worker/tasks/obs.yml
@@ -58,6 +58,15 @@
     name: mount-securityfs.service
     enabled: yes

+- name: create /etc/systemd/system/obsworker.service.d/
+  file:
+    path: /etc/systemd/system/obsworker.service.d/
+
+- name: configure systemd service to restart on failure
+  ansible.builtin.copy:
+    src: obsworker.conf
+    dest: /etc/systemd/system/obsworker.service.d/override.conf
+
 - name: ensure the systemd service is installed
   systemd:
     name: obsworker.service

--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/43206?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I81fe02984d6c227a482b0b2421a967def1e208d5
Gerrit-Change-Number: 43206
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to