From bea68f18cc75138cc1465dd56dbe8d957f8242ad Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Fri, 2 Jun 2017 17:00:17 +0100 Subject: [PATCH] tasks: Set Restart option for systemd service file In order to have a consistent systemd behavior across distributions, we define the Restart condition for the galera service file. The 'on-abort' option is currently the default in the upstream service file and it's also the most conservative one so we chose that to be the default option in the Ansible role as well. We also set a reasonably low RestartSec value as well. Change-Id: If442802f7aff4473cbb573ba1c123cfc46bde9b3 --- tasks/galera_post_install.yml | 1 + templates/systemd.restart.conf.j2 | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 templates/systemd.restart.conf.j2 diff --git a/tasks/galera_post_install.yml b/tasks/galera_post_install.yml index a1b0bdc4..e61d07f7 100644 --- a/tasks/galera_post_install.yml +++ b/tasks/galera_post_install.yml @@ -104,6 +104,7 @@ with_items: - { src: "systemd.limits.conf.j2", dest: "limits.conf" } - { src: "systemd.timeout.conf.j2", dest: "timeout.conf" } + - { src: "systemd.restart.conf.j2", dest: "restart.conf" } when: - ansible_service_mgr == 'systemd' notify: diff --git a/templates/systemd.restart.conf.j2 b/templates/systemd.restart.conf.j2 new file mode 100644 index 00000000..8ae392b7 --- /dev/null +++ b/templates/systemd.restart.conf.j2 @@ -0,0 +1,9 @@ +# {{ ansible_managed }} + +[Service] +# Define the condition under which the service will be restarted +# on-abort is the most conservative one since that should capture unexpected +# failures but also exclude failures due to bad configurations. This is +# currently the upstream option as well +Restart=on-abort +RestartSec=5s