Commit 8b6fb3e5 authored by julian.gethmann's avatar julian.gethmann

Add rule to make smartd mail to the admin if disks crash

* enable smartd
* scan discs every night
* mail if discs get corrupt
parent aaadf784
...@@ -48,3 +48,4 @@ userinstall_vars: ...@@ -48,3 +48,4 @@ userinstall_vars:
- {name: "gethmann", password: "$6$HEmrpe9IMPI7nwxK$7VyjN.1tf/bJ2JJUeXQa.HEK3PFB1ggUVqpvMD0M/b/Ln.8QkzSMit9xukPaNhVg4caTnQBmcn1DXVwbfCmJt."} - {name: "gethmann", password: "$6$HEmrpe9IMPI7nwxK$7VyjN.1tf/bJ2JJUeXQa.HEK3PFB1ggUVqpvMD0M/b/Ln.8QkzSMit9xukPaNhVg4caTnQBmcn1DXVwbfCmJt."}
- {name: "bernhard", password: "$6$Q9NiWWvweGVfXXUP$6jhQWNGEs1f/RZc2aeDJ4Wv7huT5eAyW/uO0hOr8Yzi.h5Sa149LDpzp6utQI2VbnKF6O7TfpZeoKHFaNKGY51"} - {name: "bernhard", password: "$6$Q9NiWWvweGVfXXUP$6jhQWNGEs1f/RZc2aeDJ4Wv7huT5eAyW/uO0hOr8Yzi.h5Sa149LDpzp6utQI2VbnKF6O7TfpZeoKHFaNKGY51"}
admin_mail: gethmann@kit.edu
...@@ -66,3 +66,15 @@ ...@@ -66,3 +66,15 @@
service: service:
name: ufw name: ufw
state: restarted state: restarted
- name: enable smartd
become: yes
service:
name: smartd
state: enabled
- name: restart smartd
become: yes
service:
name: smartd
state: restarted
---
dependencies:
- { role: mail }
...@@ -9,3 +9,5 @@ ...@@ -9,3 +9,5 @@
- include: yumrepos.yml - include: yumrepos.yml
tags: lasrepo tags: lasrepo
- include: software.yml - include: software.yml
- include: smartd.yml
tags: smartd
---
- name: install smartd
become: yes
package:
name: smartmontools
state: installed
notify:
- enable smartd
- restart smartd
- name: configure smartd on Fedora/CentOS
become: yes
lineinfile:
line: "DEVICESCAN -H -m {{ admin_mail }} -M exec /usr/libexec/smartmontools/smartdnotify -n standby,10,q -s (S/../.././02|L/../../6/03) -W 4,35,40"
regexp: ^DEVICESCAN .*$
backup: yes
path: /etc/smartmontools/smartd.conf
notify:
- enable smartd
- restart smartd
when: (ansible_distribution == "Fedora" or ansible_distribution == "CentOS")
---
- name: install ssmtp and mailx
become: yes
package:
name: "{{ item }}"
state: installed
with_items:
- ssmtp
- mailx
- name: configure ssmtp user
become: yes
lineinfile:
line: "{{ item }}={{ admin_mail }}"
regexp: "^{{ item }}=.*$"
backup: yes
path: /etc/ssmtp/ssmtp.conf
state: present
with_items:
- root
- postmaster
- name: configure ssmtp mailhub
become: yes
lineinfile:
line: mailhub=smarthost.kit.edu
regexp: ^mailhub=.*$
backup: yes
path: /etc/ssmtp/ssmtp.conf
state: present
- name: configure ssmtp alias for root
become: yes
lineinfile:
line: "root:{{ admin_mail }}:smarthost.kit.edu"
regexp: ^root:.*$
backup: yes
path: /etc/ssmtp/revaliases
state: present
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment