aboutsummaryrefslogtreecommitdiffstats
path: root/tasks/zfs.yml
blob: 59495dcb017848bd384e14432f5dbf3f1192e3ac (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
- name: Ensure /usr/local/etc/rc.d/ exists
  file:
    path: /usr/local/etc/rc.d/
    state: directory
    owner: root
    group: wheel
    mode: "0755"

- name: Add zpool_gpt_labels rc.d service
  template:
    src: usr_local_etc_rc.d_zpool_gpt_labels.j2
    dest: /usr/local/etc/rc.d/zpool_gpt_labels
    owner: root
    group: wheel
    mode: "0755"
  register: rc_zpool_gpt_labels

- name: Run zpool_gpt_labels
  service:
    name: zpool_gpt_labels
    state: started
  when: rc_zpool_gpt_labels.changed

- name: Install smartd
  package:
    name: smartmontools
    state: present

- name: Configure smartd.conf
  template:
    src: usr_local_etc_smartd.conf.j2
    dest: /usr/local/etc/smartd.conf
    owner: root
    group: wheel
    mode: "0644"
  register: smartd_conf

- name: Start smartd
  service:
    name: smartd
    state: started
  register: started_smartd

- name: Restart smartd
  service:
    name: smartd
    state: restarted
  when: not started_smartd.changed and smartd_conf.changed