From 90d498034b891123350785a134402172de477f4f Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 11 May 2016 18:07:09 +0200 Subject: Use systemd unit files for stunnel4. --- roles/common/tasks/bacula.yml | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'roles/common/tasks/bacula.yml') diff --git a/roles/common/tasks/bacula.yml b/roles/common/tasks/bacula.yml index e29f01c..f0919e4 100644 --- a/roles/common/tasks/bacula.yml +++ b/roles/common/tasks/bacula.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-fd tags: - genkey @@ -46,7 +36,7 @@ register: r2 when: "'bacula-dir' not in group_names" notify: - - Restart stunnel + - Restart stunnel@bacula-fd - name: Copy Bacula SD X.509 certificates copy: src=certs/bacula/{{ hostvars[item].inventory_hostname_short }}-sd.pem @@ -56,7 +46,7 @@ register: r3 with_items: "{{ groups['bacula-sd'] | difference([inventory_hostname]) }}" notify: - - Restart stunnel + - Restart stunnel@bacula-fd - name: Configure stunnel template: src=etc/stunnel/bacula-fd.conf.j2 @@ -66,11 +56,16 @@ register: r4 when: "'bacula-dir' not in group_names or 'bacula-sd' not in group_names" notify: - - Restart stunnel + - Restart stunnel@bacula-fd + +- name: Enable stunnel@bacula-fd + when: "'bacula-dir' not in group_names or 'bacula-sd' not in group_names" + service: name=stunnel4@bacula-fd enabled=yes -- name: Start stunnel - service: name=stunnel4 pattern=/usr/bin/stunnel4 state=started - when: not (r1.changed or r2.changed or r3.changed or r4.changed) +- name: Start stunnel@bacula-fd + service: name=stunnel4@bacula-fd state=started + when: ('bacula-dir' not in group_names or 'bacula-sd' not in group_names) and + not (r1.changed or r2.changed or r3.changed or r4.changed) - meta: flush_handlers -- cgit v1.2.3