Files
ansible/roles/cron/tasks/main.yml
T
PhilandClaude Opus 5.5 c0145dd5a2 Harden permissions, close exposed ports, and clean up tasks
- Quote file modes. Unquoted 644/755 were read as decimal, so files
  landed as 1204. Templates holding secrets are now 0640 root:docker.
- Stop publishing Authentik 9000/9443 and Karakeep 3000 (Caddy reaches
  them over the docker network), bind dir2opds to the Tailscale IP, and
  drop Caddy's unused 8448.
- Atuin login uses no_log and only runs once; the installer only runs
  when Atuin is missing.
- Make chsh, ufw-docker install, the bat symlink and Atuin dotfiles
  idempotent.
- Back up the Paperless data volume (SQLite DB), stopping Paperless
  during the backup.
- Close public sign-up on kosync and ByteStash.
- Replace hardcoded IPs and domains with variables.
- Remove teardown tasks and templates for 9 retired services.
- Fix the dockcheck comment: it auto-updates labelled containers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 21:03:54 -06:00

116 lines
3.2 KiB
YAML

---
# Enable cron logging in systemd-journald (already enabled by default)
# We'll rely on journalctl for cron execution logs
# Ensure the script is copied to the target machine
- name: Copy the warhammer feed update script
copy:
src: update_warhammer_feed.sh
dest: /usr/local/bin/update_warhammer_feed.sh
mode: '0755'
owner: root
group: root
# Create the cron job to run the script at 09:10 every day
- name: Create cron job for warhammer feed update
cron:
name: "Update Warhammer RSS Feed"
minute: "10"
hour: "9"
user: root
job: "/usr/local/bin/update_warhammer_feed.sh"
# Create .local/bin directory for phil user
- name: Ensure .local/bin directory exists for phil
file:
path: /home/phil/.local/bin
state: directory
mode: '0755'
owner: phil
group: phil
# Install dockcheck script in phil's .local/bin
- name: Download dockcheck.sh script
get_url:
url: https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh
dest: /home/phil/.local/bin/dockcheck.sh
mode: '0755'
owner: phil
group: phil
# Create .config directory for phil user
- name: Ensure .config directory exists for phil
file:
path: /home/phil/.config
state: directory
mode: '0755'
owner: phil
group: phil
# Create notify_templates directory alongside dockcheck.sh
- name: Ensure notify_templates directory exists in .local/bin
file:
path: /home/phil/.local/bin/notify_templates
state: directory
mode: '0755'
owner: phil
group: phil
# 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
dest: /home/phil/.local/bin/notify_templates/notify_v2.sh
mode: '0755'
owner: phil
group: phil
# 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
dest: /home/phil/.local/bin/notify_templates/notify_gotify.sh
mode: '0755'
owner: phil
group: phil
# Template dockcheck configuration file
- name: Template dockcheck configuration
template:
src: dockcheck.config.j2
dest: /home/phil/.config/dockcheck.config
mode: '0600'
owner: phil
group: phil
# Create log directory for dockcheck
- name: Create dockcheck log directory
file:
path: /var/log/dockcheck
state: directory
mode: '0755'
owner: phil
group: phil
# Create dockcheck wrapper script to avoid cron escaping issues
- name: Create dockcheck wrapper script
copy:
dest: /home/phil/.local/bin/run_dockcheck.sh
mode: '0755'
owner: phil
group: phil
content: |
#!/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
# Create cron job for dockcheck as phil user with logging
- name: Create cron job for dockcheck container updates
cron:
name: "Check Docker container updates"
minute: "0"
hour: "8"
user: phil
job: "/home/phil/.local/bin/run_dockcheck.sh"