diff --git a/roles/cron/files/update_warhammer_feed.sh b/roles/cron/files/update_warhammer_feed.sh new file mode 100644 index 0000000..c0e93ca --- /dev/null +++ b/roles/cron/files/update_warhammer_feed.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Create and navigate to a temporary directory +TMP_DIR="/tmp/warhammer_feed" +mkdir -p "$TMP_DIR" +cd "$TMP_DIR" || exit 1 + +# Run the Docker command to generate the RSS feed +docker run --rm -v "$TMP_DIR":/app/output git.thesatelliteoflove.com/phil/rss-warhammer + +# Copy the generated file to the desired location +cp "$TMP_DIR/warhammer_rss_feed.xml" /opt/stacks/caddy/site/tsol/feeds + +# Restart the Docker stack +docker compose -f /opt/stacks/glance/compose.yml restart diff --git a/roles/cron/tasks/main.yml b/roles/cron/tasks/main.yml new file mode 100644 index 0000000..d1a2adb --- /dev/null +++ b/roles/cron/tasks/main.yml @@ -0,0 +1,18 @@ +--- +# 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" diff --git a/site.yml b/site.yml index 0b38e4b..e0e5d09 100644 --- a/site.yml +++ b/site.yml @@ -1,5 +1,6 @@ - hosts: docker become: true roles: - - common - - docker \ No newline at end of file + - { role: common, tags: ["common"] } + - { role: docker, tags: ["docker"] } + - { role: cron, tags: ["cron"] } \ No newline at end of file