summaryrefslogtreecommitdiffstats
path: root/roles/bacula-dir/tasks/main.yml
blob: 53d44eefe5327579ccf78f54e1457fbb7ca71642 (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
63
64
65
- name: Install bacula-director
  apt: pkg={{ packages }}
  vars:
    packages:
    - bacula-console
    - bacula-director
    - bacula-director-mysql

- name: Create a 'bacula' SQL user
  mysql_user: name=bacula password= plugin=unix_socket
              state=present
  notify:
    - Restart bacula-director

# Populate with:
#   echo bconsole $(pwgen -sn 64 1) | sudo tee -a /etc/bacula/passwords-dir
#   echo $sd-sd   $(pwgen -sn 64 1) | sudo tee -a /etc/bacula/passwords-dir
#   echo $fd-fd   $(pwgen -sn 64 1) | sudo tee -a /etc/bacula/passwords-dir
#
# then add the password for each FD / SD:
#   echo $director-dir $password | sudo tee /etc/bacula/passwords-sd
#   echo $director-dir $password | sudo tee /etc/bacula/passwords-fd
- name: Ensure /etc/bacula/passwords-dir exists
  file: path=/etc/bacula/passwords-dir
        state=file
        owner=bacula group=bacula
        mode=0600

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

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

- name: Create /etc/systemd/system/bacula-director.service.d
  file: path=/etc/systemd/system/bacula-director.service.d
        state=directory
        owner=root group=root
        mode=0755

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

- meta: flush_handlers

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

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