From 43e1002bccd26131c9036cb3f15253bbbc695514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Rzepecki?= Date: Mon, 21 Dec 2015 16:04:07 +0100 Subject: [PATCH] Add systemd support [delivers #110502712] --- files/default/systemd/logshipper.service | 13 +++++++++++++ libraries/conjur_helper_methods.rb | 2 ++ recipes/_install_logshipper_systemd.rb | 13 +++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 files/default/systemd/logshipper.service create mode 100644 recipes/_install_logshipper_systemd.rb diff --git a/files/default/systemd/logshipper.service b/files/default/systemd/logshipper.service new file mode 100644 index 0000000..ea18d1f --- /dev/null +++ b/files/default/systemd/logshipper.service @@ -0,0 +1,13 @@ +[Unit] +Description=Conjur log shipping service +Documentation=https://developer.conjur.net +RequiresOverridable=rsyslog.service + +[Service] +ExecStart=/usr/sbin/logshipper -n /var/run/logshipper +Restart=always +User=logshipper +Group=conjur + +[Install] +WantedBy=rsyslog.target diff --git a/libraries/conjur_helper_methods.rb b/libraries/conjur_helper_methods.rb index 503e3d5..0b5090d 100644 --- a/libraries/conjur_helper_methods.rb +++ b/libraries/conjur_helper_methods.rb @@ -9,6 +9,8 @@ module ConjurDetect def self.detect_init if test 'x', '/sbin/runit' 'runit' + elsif test 'x', '/usr/bin/systemctl' + 'systemd' else 'upstart' end diff --git a/recipes/_install_logshipper_systemd.rb b/recipes/_install_logshipper_systemd.rb new file mode 100644 index 0000000..428f945 --- /dev/null +++ b/recipes/_install_logshipper_systemd.rb @@ -0,0 +1,13 @@ +cookbook_file '/etc/systemd/system/logshipper.service' do + source 'systemd/logshipper.service' + owner 'root' + group 'root' + mode '0755' +end + +bash 'enable and run logshipper' do + code """ + systemctl enable logshipper + systemctl start logshipper + """ +end