summaryrefslogtreecommitdiffstats
path: root/roles/bacula-dir/tasks/main.yml
blob: 30a25c12dab01fd3b02806eae8b5b4db9f71ac0f (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
- name: Install bacula-director
  apt: pkg={{ item }}
  with_items:
    - bacula-console
    - bacula-director-mysql

- name: Create a 'bacula' SQL user
  mysql_user2: name=bacula password= auth_plugin=auth_socket
               state=present
  notify:
    - Restart bacula-director

# Create 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: Copy bacula-director.service
  copy: src=lib/systemd/system/bacula-director.service
        dest=/lib/systemd/system/bacula-director.service
        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