mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-29 16:01:04 +01:00
created health check for btrfs
This commit is contained in:
parent
3b30832e60
commit
5caeb99c1d
@ -7,6 +7,11 @@
|
||||
- system-update
|
||||
- native-journalctl
|
||||
#- native-hostname
|
||||
- name: setup btrfs health check
|
||||
hosts: btrfs_health_check_hosts
|
||||
become: true
|
||||
roles:
|
||||
- native-btrfs-health-check
|
||||
- name: setup standard wireguard hosts
|
||||
hosts: wireguard_hosts
|
||||
become: true
|
||||
|
8
roles/native-btrfs-health-check/README.md
Normal file
8
roles/native-btrfs-health-check/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# btrfs-health-check
|
||||
|
||||
Sends a health report
|
||||
|
||||
## see
|
||||
- https://superuser.com/questions/789303/how-to-monitor-btrfs-filesystem-raid-for-errors
|
||||
- https://unix.stackexchange.com/questions/193619/list-all-btrfs-filesystems-and-subvolumes-in-shell
|
||||
- https://www.freedesktop.org/software/systemd/man/systemd.unit.html
|
@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Check btrfs status
|
||||
OnFailure=systemd-email@%n.service
|
||||
OnSuccess=systemd-email@%n.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/bash /home/administrator/scripts/btrfs-health-check/btrfs-health-check.sh
|
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
# Checks the healt of all btrfs volumes
|
||||
for path in $(btrfs filesystem show | awk '/ path /{print $NF}')
|
||||
do
|
||||
btrfs device stats $path
|
||||
done
|
@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=starts btrfs-health-check.service
|
||||
|
||||
[Timer]
|
||||
OnCalendar=12:00
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
12
roles/native-btrfs-health-check/handlers/main.yml
Normal file
12
roles/native-btrfs-health-check/handlers/main.yml
Normal file
@ -0,0 +1,12 @@
|
||||
- name: "restart btrfs-health-check.service"
|
||||
systemd:
|
||||
name: btrfs-health-check.service
|
||||
state: restarted
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
- name: "restart btrfs-health-check.timer"
|
||||
systemd:
|
||||
name: btrfs-health-check.timer
|
||||
state: restarted
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
2
roles/native-btrfs-health-check/meta/main.yml
Normal file
2
roles/native-btrfs-health-check/meta/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- native-systemd-email
|
22
roles/native-btrfs-health-check/tasks/main.yml
Normal file
22
roles/native-btrfs-health-check/tasks/main.yml
Normal file
@ -0,0 +1,22 @@
|
||||
- name: "create /home/administrator/scripts/btrfs-health-check/"
|
||||
file:
|
||||
path: "/home/administrator/scripts/btrfs-health-check"
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: create btrfs-health-check.sh
|
||||
copy:
|
||||
src: btrfs-health-check.sh
|
||||
dest: "/home/administrator/scripts/btrfs-health-check/btrfs-health-check.sh"
|
||||
|
||||
- name: create btrfs-health-check.service
|
||||
copy:
|
||||
src: btrfs-health-check.service
|
||||
dest: "/etc/systemd/system/btrfs-health-check.service"
|
||||
notify: restart btrfs-health-check.service
|
||||
|
||||
- name: create btrfs-health-check.timer
|
||||
copy:
|
||||
src: btrfs-health-check.timer
|
||||
dest: "/etc/systemd/system/btrfs-health-check.timer"
|
||||
notify: restart btrfs-health-check.timer
|
Loading…
Reference in New Issue
Block a user