summaryrefslogtreecommitdiffstats
path: root/roles/bacula-sd
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2016-05-11 18:07:09 +0200
committerGuilhem Moulin <guilhem@fripost.org>2016-05-12 11:33:55 +0200
commit90d498034b891123350785a134402172de477f4f (patch)
treea6e3c924054c3f689cdaffffe3a479e88fb97282 /roles/bacula-sd
parente370313ad5895871479fffc922e3c72c0375dbf2 (diff)
Use systemd unit files for stunnel4.
Diffstat (limited to 'roles/bacula-sd')
-rw-r--r--roles/bacula-sd/handlers/main.yml4
-rw-r--r--roles/bacula-sd/tasks/main.yml21
-rw-r--r--roles/bacula-sd/templates/etc/stunnel/bacula-sd.conf.j23
3 files changed, 11 insertions, 17 deletions
diff --git a/roles/bacula-sd/handlers/main.yml b/roles/bacula-sd/handlers/main.yml
index ce391d2..c6adb80 100644
--- a/roles/bacula-sd/handlers/main.yml
+++ b/roles/bacula-sd/handlers/main.yml
@@ -2,8 +2,8 @@
- name: systemctl daemon-reload
command: /bin/systemctl daemon-reload
-- name: Restart stunnel
- service: name=stunnel4 pattern=/usr/bin/stunnel4 state=restarted
+- name: Restart stunnel@bacula-sd
+ service: name=stunnel4@bacula-sd state=restarted
- name: Restart bacula-sd
service: name=bacula-sd state=restarted
diff --git a/roles/bacula-sd/tasks/main.yml b/roles/bacula-sd/tasks/main.yml
index a888db6..5de0d3d 100644
--- a/roles/bacula-sd/tasks/main.yml
+++ b/roles/bacula-sd/tasks/main.yml
@@ -1,13 +1,3 @@
-- name: Install stunnel
- apt: pkg=stunnel4
-
-- name: Auto-enable stunnel
- lineinfile: dest=/etc/default/stunnel4
- regexp='^(\s*#)?\s*ENABLED='
- line='ENABLED=1'
- owner=root group=root
- mode=0644
-
- name: Create /etc/stunnel/certs
file: path=/etc/stunnel/certs
state=directory
@@ -24,7 +14,7 @@
changed_when: r1.rc == 0
failed_when: r1.rc > 1
notify:
- - Restart stunnel
+ - Restart stunnel@bacula-sd
tags:
- genkey
@@ -45,7 +35,7 @@
mode=0644
register: r2
notify:
- - Restart stunnel
+ - Restart stunnel@bacula-sd
- name: Configure stunnel
template: src=etc/stunnel/bacula-sd.conf.j2
@@ -54,10 +44,13 @@
mode=0644
register: r3
notify:
- - Restart stunnel
+ - Restart stunnel@bacula-sd
+
+- name: Enable stunnel@bacula-sd
+ service: name=stunnel4@bacula-sd enabled=yes
- name: Start stunnel
- service: name=stunnel4 pattern=/usr/bin/stunnel4 state=started
+ service: name=stunnel4@bacula-sd state=started
when: not (r1.changed or r2.changed or r3.changed)
- meta: flush_handlers
diff --git a/roles/bacula-sd/templates/etc/stunnel/bacula-sd.conf.j2 b/roles/bacula-sd/templates/etc/stunnel/bacula-sd.conf.j2
index 767424a..f0234fa 100644
--- a/roles/bacula-sd/templates/etc/stunnel/bacula-sd.conf.j2
+++ b/roles/bacula-sd/templates/etc/stunnel/bacula-sd.conf.j2
@@ -7,7 +7,8 @@ setuid = stunnel4
setgid = stunnel4
; PID is created inside the chroot jail
-pid = /var/run/stunnel4/bacula-sd.pid
+pid =
+foreground = yes
; Only log messages at severity warning (4) and higher
debug = 4