cron: refresh dockcheck setup
- Pin dockcheck (v0.8.3) and regctl (v0.11.7) and re-download on version bumps; get_url never replaced existing files, and dockcheck never updates regctl itself (server had regctl v0.8.3 from June 2025) - New options: DaysOld=3, BackupForDays=7 (rollback), MaxAsync=10, MonoMode for the log, PrintReleaseURL with upstream urls.list - Drop authentik-postgresql-1 from Exclude (container is gone) - Wrapper logged exit code 0 always ($? read after $(date)); fixed - Rotate /var/log/dockcheck/dockcheck.log weekly - Remove stale ~/.local/bin/notify_v2.sh Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b914460b72
commit
a5cdfded37
4 files changed
+93
-10
No files matched your search
@@ -29,15 +29,44 @@
|
||||
owner: phil
|
||||
group: phil
|
||||
|
||||
# Install dockcheck script in phil's .local/bin
|
||||
# Install dockcheck in phil's .local/bin, pinned to dockcheck_version.
|
||||
# force: a version bump replaces the file (get_url otherwise never re-downloads).
|
||||
- name: Download dockcheck.sh script
|
||||
get_url:
|
||||
url: https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh
|
||||
url: "https://raw.githubusercontent.com/mag37/dockcheck/{{ dockcheck_version }}/dockcheck.sh"
|
||||
dest: /home/phil/.local/bin/dockcheck.sh
|
||||
force: true
|
||||
mode: '0755'
|
||||
owner: phil
|
||||
group: phil
|
||||
|
||||
# dockcheck only downloads regctl when it's missing, so it never updates by itself
|
||||
- name: Download regctl
|
||||
get_url:
|
||||
url: "https://github.com/regclient/regclient/releases/download/{{ regctl_version }}/regctl-linux-amd64"
|
||||
dest: /home/phil/.local/bin/regctl
|
||||
force: true
|
||||
mode: '0755'
|
||||
owner: phil
|
||||
group: phil
|
||||
|
||||
# Release-note links for known images, shown with each update (PrintReleaseURL).
|
||||
# dockcheck reads it from beside dockcheck.sh.
|
||||
- name: Download dockcheck release-note URL list
|
||||
get_url:
|
||||
url: "https://raw.githubusercontent.com/mag37/dockcheck/{{ dockcheck_version }}/notify_templates/urls.list"
|
||||
dest: /home/phil/.local/bin/urls.list
|
||||
force: true
|
||||
mode: '0644'
|
||||
owner: phil
|
||||
group: phil
|
||||
|
||||
# Left over from an old install; dockcheck reads notify_templates/notify_v2.sh
|
||||
- name: Remove stale notify_v2.sh beside dockcheck.sh
|
||||
file:
|
||||
path: /home/phil/.local/bin/notify_v2.sh
|
||||
state: absent
|
||||
|
||||
# Create .config directory for phil user
|
||||
- name: Ensure .config directory exists for phil
|
||||
file:
|
||||
@@ -59,8 +88,9 @@
|
||||
# Download notify_v2.sh script for dockcheck notifications
|
||||
- name: Download notify_v2.sh script
|
||||
get_url:
|
||||
url: https://raw.githubusercontent.com/mag37/dockcheck/main/notify_templates/notify_v2.sh
|
||||
url: "https://raw.githubusercontent.com/mag37/dockcheck/{{ dockcheck_version }}/notify_templates/notify_v2.sh"
|
||||
dest: /home/phil/.local/bin/notify_templates/notify_v2.sh
|
||||
force: true
|
||||
mode: '0755'
|
||||
owner: phil
|
||||
group: phil
|
||||
@@ -68,8 +98,9 @@
|
||||
# Download notify_gotify.sh script for dockcheck notifications
|
||||
- name: Download notify_gotify.sh script
|
||||
get_url:
|
||||
url: https://raw.githubusercontent.com/mag37/dockcheck/main/notify_templates/notify_gotify.sh
|
||||
url: "https://raw.githubusercontent.com/mag37/dockcheck/{{ dockcheck_version }}/notify_templates/notify_gotify.sh"
|
||||
dest: /home/phil/.local/bin/notify_templates/notify_gotify.sh
|
||||
force: true
|
||||
mode: '0755'
|
||||
owner: phil
|
||||
group: phil
|
||||
@@ -103,7 +134,27 @@
|
||||
#!/bin/bash
|
||||
cd /home/phil
|
||||
/home/phil/.local/bin/dockcheck.sh >> /var/log/dockcheck/dockcheck.log 2>&1
|
||||
echo "$(date "+%Y-%m-%d %H:%M:%S") - Dockcheck completed with exit code $?" >> /var/log/dockcheck/dockcheck.log
|
||||
# Save the code first: $(date) inside the echo would reset $?
|
||||
code=$?
|
||||
echo "$(date "+%Y-%m-%d %H:%M:%S") - Dockcheck completed with exit code $code" >> /var/log/dockcheck/dockcheck.log
|
||||
|
||||
# The log grows by about 3 MB a year; keep a year in weekly files
|
||||
- name: Rotate the dockcheck log
|
||||
copy:
|
||||
dest: /etc/logrotate.d/dockcheck
|
||||
mode: '0644'
|
||||
owner: root
|
||||
group: root
|
||||
content: |
|
||||
/var/log/dockcheck/dockcheck.log {
|
||||
weekly
|
||||
rotate 52
|
||||
compress
|
||||
delaycompress
|
||||
missingok
|
||||
notifempty
|
||||
su phil phil
|
||||
}
|
||||
|
||||
# Create cron job for dockcheck as phil user with logging
|
||||
- name: Create cron job for dockcheck container updates
|
||||
|
||||
Reference in new issue
Block a user