diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2016-05-11 18:07:09 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2016-05-12 11:33:55 +0200 |
commit | 90d498034b891123350785a134402172de477f4f (patch) | |
tree | a6e3c924054c3f689cdaffffe3a479e88fb97282 /roles/bacula-dir | |
parent | e370313ad5895871479fffc922e3c72c0375dbf2 (diff) |
Use systemd unit files for stunnel4.
Diffstat (limited to 'roles/bacula-dir')
-rw-r--r-- | roles/bacula-dir/handlers/main.yml | 4 | ||||
-rw-r--r-- | roles/bacula-dir/tasks/main.yml | 25 | ||||
-rw-r--r-- | roles/bacula-dir/templates/etc/stunnel/bacula-dir.conf.j2 | 3 |
3 files changed, 13 insertions, 19 deletions
diff --git a/roles/bacula-dir/handlers/main.yml b/roles/bacula-dir/handlers/main.yml index 175dfb2..778a1c4 100644 --- a/roles/bacula-dir/handlers/main.yml +++ b/roles/bacula-dir/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-dir + service: name=stunnel4@bacula-dir state=restarted - name: Restart bacula-director service: name=bacula-director state=restarted diff --git a/roles/bacula-dir/tasks/main.yml b/roles/bacula-dir/tasks/main.yml index f86d713..6799900 100644 --- a/roles/bacula-dir/tasks/main.yml +++ b/roles/bacula-dir/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-dir tags: - genkey @@ -46,7 +36,7 @@ with_items: "{{ groups['bacula-sd'] | difference([inventory_hostname]) | sort }}" register: r2 notify: - - Restart stunnel + - Restart stunnel@bacula-dir - name: Copy Bacula FD X.509 certificates copy: src=certs/bacula/{{ hostvars[item].inventory_hostname_short }}-fd.pem @@ -56,7 +46,7 @@ with_items: "{{ groups.all | difference([inventory_hostname]) | sort }}" register: r3 notify: - - Restart stunnel + - Restart stunnel@bacula-dir - name: Configure stunnel template: src=etc/stunnel/bacula-dir.conf.j2 @@ -65,10 +55,13 @@ mode=0644 register: r4 notify: - - Restart stunnel + - Restart stunnel@bacula-dir + +- name: Enable stunnel@bacula-dir + service: name=stunnel4@bacula-dir enabled=yes -- name: Start stunnel - service: name=stunnel4 pattern=/usr/bin/stunnel4 state=started +- name: Start stunnel@bacula-dir + service: name=stunnel4@bacula-dir state=started when: not (r1.changed or r2.changed or r3.changed or r4.changed) - meta: flush_handlers diff --git a/roles/bacula-dir/templates/etc/stunnel/bacula-dir.conf.j2 b/roles/bacula-dir/templates/etc/stunnel/bacula-dir.conf.j2 index 4dbb1db..e6ab105 100644 --- a/roles/bacula-dir/templates/etc/stunnel/bacula-dir.conf.j2 +++ b/roles/bacula-dir/templates/etc/stunnel/bacula-dir.conf.j2 @@ -7,7 +7,8 @@ setuid = stunnel4 setgid = stunnel4 ; PID is created inside the chroot jail -pid = /var/run/stunnel4/bacula-dir.pid +pid = +foreground = yes ; Only log messages at severity warning (4) and higher debug = 4 |