summaryrefslogtreecommitdiffstats
path: root/roles/bacula-sd/tasks/main.yml
blob: ad77db493dc9a3312fede8651e2d34323134c86a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
- name: Install bacula-sd
  apt: pkg=bacula-sd

# Create with:
#   echo $director-dir $(pwgen -sn 64 1) | sudo tee -a /etc/bacula/passwords-sd
- name: Ensure /etc/bacula/passwords-sd exists
  file: path=/etc/bacula/passwords-sd
        state=file
        owner=bacula group=bacula
        mode=0600

- name: Configure bacula
  template: src=etc/bacula/bacula-sd.conf.j2
            dest=/etc/bacula/bacula-sd.conf
            owner=root group=root
            mode=0644
  notify:
    - Restart bacula-sd

- name: Copy bacula-sd.service
  copy: src=lib/systemd/system/bacula-sd.service
        dest=/lib/systemd/system/bacula-sd.service
        owner=root group=root
        mode=0644
  notify:
    - systemctl daemon-reload
    - Restart bacula-sd

- meta: flush_handlers

- name: Enable bacula-sd
  service: name=bacula-sd enabled=yes

- name: Start bacula-sd
  service: name=bacula-sd state=started

# To avoid bacula creating archives under /mnt/backup/bacula when it's
# not a mountpoint, use `chmod 0700 /mnt/backup; chown root:root /mnt/backup`
# before mounting the disk.
- name: Create /mnt/backup/bacula
  file: path=/mnt/backup/bacula
        state=directory
        owner=bacula group=tape
        mode=0750