30 lines
651 B
YAML
30 lines
651 B
YAML
- name: "install smartmontools"
|
|
ansible.builtin.apt:
|
|
name: "smartmontools"
|
|
|
|
- name: "smartd configuration"
|
|
ansible.builtin.copy:
|
|
src: "{{ smartd_conf_file_path }}"
|
|
dest: "/etc/smartd.conf"
|
|
mode: 0644
|
|
register: smartd_conf
|
|
|
|
- name: "enable smartmontools"
|
|
ansible.builtin.systemd:
|
|
name: "smartmontools"
|
|
enabled: true
|
|
|
|
- name: "start smartmontools"
|
|
ansible.builtin.systemd:
|
|
name: "smartmontools"
|
|
state: "started"
|
|
register: smartd_start
|
|
|
|
- name: "restart smartmontools"
|
|
ansible.builtin.systemd:
|
|
name: "smartmontools"
|
|
state: "restarted"
|
|
when:
|
|
smartd_conf.changed and
|
|
not smartd_start.changed
|