Compare commits

...

5 Commits

5 changed files with 49 additions and 8 deletions

View File

@ -20,3 +20,8 @@ minecraft_var_path: /var/opt/minecraft
minecraft_syslog_facility: local5
minecraft_notifier_state: present
minecraft_config:
white-list: true
enforce-whitelist: true
server-port: 25565

View File

@ -1,3 +1,5 @@
white-list: {{ (minecraft_config.whitelist | default(true)) | ternary('true', 'false') }}
enforce-whitelist: {{ (minecaft_config.enfoce_whitelist | default(true)) | ternary('true', 'false') }}
server-port: {{ item.port | default(25565) }}
# {{ ansible_managed }}
{% for k, v in minecraft_config.items() | default({}) %}
{{ k }}: {{ v }}
{% endfor %}

View File

@ -65,6 +65,8 @@ if [ -z "${PATHS+x}" ]; then
error_exit "\$PATHS is not set"
fi
START="$(date +%s)"
if [ -f "$LOCK" ]; then
pid=$(cat "$LOCK")
if ! kill -0 "$pid" 2> /dev/null; then
@ -86,6 +88,8 @@ fi
echo $$ > "$LOCK"
LOCKED=$(($(date +%s) - START))
printf "job '%s' started\n" "$JOB"
if [ -d "${HOOKS_PATH}" ]; then
@ -111,10 +115,12 @@ until [ $counter -eq "$MAX_ATTEMPTS" ] || [ $rc -eq 0 ]; do
rc=$?
if [ $rc -ne 0 ]; then
sleep=$((counter * 5))
printf "sleeping for %d seconds (%d)\n" $sleep $counter
sleep $sleep
if [ $rc -eq 0 ]; then
break
else
sleep=$((counter * 5))
printf "sleeping for %d seconds (%d)\n" $sleep $counter
sleep $sleep
fi
(( counter++ ))
@ -131,3 +137,25 @@ if [ -d "${HOOKS_PATH}" ]; then
printf "running '%s' job post-hooks\n" "$JOB"
run-parts --exit-on-error -v -a post "${HOOKS_PATH}"
fi
END=$(date +%s)
if [ -d /var/spool/node_exporter/textfile_collector ]; then
cat << EOF > "/var/spool/node_exporter/textfile_collector/restic.prom.$$"
node_restic_duration_seconds{restic_job="${JOB}"} $((END - START))
node_restic_lock_duration_seconds{restic_job="${JOB}"} $LOCKED
node_restic_last_run_time{restic_job="${JOB}"} $END
node_restic_retries{restic_job="${JOB}"} $counter
EOF
if [ -f /var/spool/node_exporter/textfile_collector/restic.prom ]; then
cat /var/spool/node_exporter/textfile_collector/restic.prom "/var/spool/node_exporter/textfile_collector/restic.prom.$$" |
tac |
awk '!seen[$1]++' |
tac |
sponge "/var/spool/node_exporter/textfile_collector/restic.prom.$$"
fi
mv "/var/spool/node_exporter/textfile_collector/restic.prom.$$" \
/var/spool/node_exporter/textfile_collector/restic.prom
fi

View File

@ -77,5 +77,7 @@
minute: "0"
hour: "2"
user: root
job: find /var/log/syslog/ -mindepth 4 -type f -name "*.log" -mtime +90 -delete
job: >
find /var/log/syslog/ -mindepth 4 -type f -name "*.log.xz" -mtime +90 -delete &&
find /var/log/syslog/ -mindepth 3 -type d -empty -delete
state: "{{ rsyslog_archival_format_enabled | ternary('present', 'absent') }}"

View File

@ -28,6 +28,7 @@ util_packages:
- traceroute
- iperf
- iperf3
- smem
math:
- bc
misc:
@ -45,6 +46,8 @@ util_packages:
- htop
- iotop
- iftop
- atop
- glances
- lsof
- sysdig
- dstat
@ -52,6 +55,7 @@ util_packages:
- gnupg
- pass
- pwgen
- apache2-utils
text:
- jq
- crudini