feat: Create role
This commit is contained in:
12
templates/scripts/disk.bash.j2
Normal file
12
templates/scripts/disk.bash.j2
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
# {{ ansible_managed }}
|
||||
|
||||
# Get disk usage in percent
|
||||
pct=$(df --output=pcent $1 | tail -n 1 | tr -d '% ')
|
||||
|
||||
# Fail if disk is used more than limit
|
||||
if [ $pct -gt $2 ]; then
|
||||
/usr/bin/curl -s --retry 5 -o /dev/null "${3}/fail"
|
||||
else
|
||||
/usr/bin/curl -s --retry 5 -o /dev/null "${3}"
|
||||
fi
|
12
templates/service.j2
Normal file
12
templates/service.j2
Normal file
@@ -0,0 +1,12 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description={{ item.name }}
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart={{ item.cmd }} "{{ hcio_url }}/ping/{{ uuid }}"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
12
templates/timer.j2
Normal file
12
templates/timer.j2
Normal file
@@ -0,0 +1,12 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description={{ item.name }}
|
||||
|
||||
[Timer]
|
||||
OnBootSec={{ (item.timeout | int) - 10 }}second
|
||||
OnUnitActiveSec={{ (item.timeout | int) - 10 }}second
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
Reference in New Issue
Block a user