Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ smartd_devices:
smartd_default_type: auto
smartd_default_nocheck: standby,15,q
smartd_default_check_type: normal
smartd_default_attribute_autosave: True
smartd_default_check_health_return_status: True
smartd_default_attribute_autosave: true
smartd_default_check_health_return_status: true
smartd_default_report_error_types:
- error
- xerror
Expand All @@ -18,9 +18,9 @@ smartd_default_test_schedule: (L/../../6/01|S/../.././02)
smartd_default_mail_frequency: diminishing
smartd_default_mail_script:
smartd_default_mail_recipients: []
smartd_default_report_ata_failure: True
smartd_default_report_ata_prefail: True
smartd_default_report_ata_usage: False
smartd_default_report_ata_failure: true
smartd_default_report_ata_prefail: true
smartd_default_report_ata_usage: true
smartd_default_ata_pending_id: 197+
smartd_default_ata_uncorrectable_id: 198+
smartd_default_temperature_report_diff: 10
Expand Down
4 changes: 2 additions & 2 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Restart smartd
service:
ansible.builtin.service:
name: "{{ smartd_service_name }}"
state: restarted
enabled: yes
enabled: true
...
12 changes: 6 additions & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
---
# Check vars/main.yml to set distro-specific config file location
- name: Set the smartd configuration file path
set_fact:
ansible.builtin.set_fact:
smartd_config_path: "{{ smartd_possible_config_paths[ansible_distribution] | default(smartd_possible_config_paths.default) }}"
smartd_file_group: "{{ smartd_possible_file_group[ansible_distribution] | default(smartd_possible_file_group.default) }}"
smartd_service_name: "{{ smartd_service_possible_name[ansible_distribution] | default(smartd_service_possible_name.default) }}"

- name: Install smartmontools
package:
ansible.builtin.package:
name: smartmontools
when: ansible_pkg_mgr in ["apt", "pacman", "dnf", "yum", "pkgng"]

- name: Create smartd configuration
template:
ansible.builtin.template:
src: smartd.conf.j2
dest: "{{ smartd_config_path }}"
owner: root
group: "{{ smartd_file_group }}"
mode: 0644
mode: "0644"
validate: smartd -q onecheck -c %s
notify: Restart smartd

- name: Enable smartd
service:
ansible.builtin.service:
name: "{{ smartd_service_name }}"
state: started
enabled: yes
enabled: true