summaryrefslogtreecommitdiffstats
path: root/roles/bacula-sd/tasks/main.yml
blob: f30fe7f0c80f1c302ffa69a25e8d0ce75fda4f57 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
- name: Install bacula-sd
  apt: pkg=bacula-sd

# Populate 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: Create /etc/systemd/system/bacula-sd.service.d
  file: path=/etc/systemd/system/bacula-sd.service.d
        state=directory
        owner=root group=root
        mode=0755

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

# Avoid bacula creating archives under /mnt/backup/bacula when it's
# not mounted
- name: Create directory /mnt/backup
  file: path=/mnt/backup
        state=directory
        owner=root group=root
        mode=0755

- name: Mount /mnt/backup
  mount: src=/dev/mapper/fripost-backup
         path=/mnt/backup
         fstype=ext4
         opts=noauto
         state=mounted

- meta: flush_handlers

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

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

- name: Create /mnt/backup/bacula
  file: path=/mnt/backup/bacula
        state=directory
        owner=bacula group=tape
        mode=0750