ansible-edda/playbooks/tasks/hosts/smart.yml

30 lines
574 B
YAML

- name: Install smartmontools
apt:
name: smartmontools
- name: Smartd configuration
copy:
src: ./filesystem/{{ ansible_hostname }}/etc/smartd.conf
dest: /etc/smartd.conf
mode: 0644
register: smartd_conf
- name: Enable smartmontools
systemd:
name: smartmontools
enabled: yes
- name: Start smartmontools
systemd:
name: smartmontools
state: started
register: smartd_start
- name: Restart smartmontools
systemd:
name: smartmontools
state: restarted
when:
smartd_conf is changed and
smartd_start is not changed