Compare commits
No commits in common. "b283cbf25cc46cacc67aac9e6ca5fa59bb40d92f" and "18c136cf35c91ea5d021cf0d6ba2bc16c60bd37e" have entirely different histories.
b283cbf25c
...
18c136cf35
2 changed files with 86 additions and 69 deletions
|
@ -24,74 +24,91 @@ jobs:
|
|||
echo "Modified folders: $folders"
|
||||
echo "::set-output name=folders::$folders"
|
||||
|
||||
- name: Deploy to hosts
|
||||
- name: Determine target host
|
||||
id: determine-host
|
||||
run: |
|
||||
IFS=' ' read -r -a folder_array <<< "${{ steps.detect-changes.outputs.folders }}"
|
||||
for folder in "${folder_array[@]}"; do
|
||||
case $folder in
|
||||
arrs)
|
||||
target_host="arrs.lan"
|
||||
;;
|
||||
arm)
|
||||
target_host="arm.lan"
|
||||
;;
|
||||
downloaders)
|
||||
target_host="downloaders.lan"
|
||||
;;
|
||||
AI)
|
||||
target_host="ai.lan"
|
||||
;;
|
||||
authentik)
|
||||
target_host="auth.lan"
|
||||
;;
|
||||
cf)
|
||||
target_host="cf.lan"
|
||||
;;
|
||||
jellyfin)
|
||||
target_host="jf.lan"
|
||||
;;
|
||||
kasm)
|
||||
target_host="kasm.lan"
|
||||
;;
|
||||
netboot)
|
||||
target_host="netboot.lan"
|
||||
;;
|
||||
nexus)
|
||||
target_host="nexus.lan"
|
||||
;;
|
||||
pages)
|
||||
target_host="pages.lan"
|
||||
;;
|
||||
portainer)
|
||||
target_host="port.lan"
|
||||
;;
|
||||
twingate)
|
||||
target_host="twingate.lan"
|
||||
;;
|
||||
whisper)
|
||||
target_host="whisper.lan"
|
||||
;;
|
||||
# Add cases for other folders/hosts
|
||||
*)
|
||||
echo "Unknown folder: $folder"
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
echo "Triggering AWX Job with target host: $target_host and folder: $folder"
|
||||
curl -X POST -k -H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" \
|
||||
-d "{\"extra_vars\": {\"target_host\": \"$target_host\", \"folder\": \"$folder\"}}" \
|
||||
"https://awx.mafyuh.xyz/api/v2/job_templates/13/launch/"
|
||||
folder=$(echo "${{ steps.detect-changes.outputs.folders }}" | head -n 1)
|
||||
if [ -z "$folder" ]; then
|
||||
echo "No modified folders detected"
|
||||
exit 1
|
||||
fi
|
||||
case $folder in
|
||||
arrs)
|
||||
target_host="arrs.lan"
|
||||
;;
|
||||
arm)
|
||||
target_host="arm.lan"
|
||||
;;
|
||||
downloaders)
|
||||
target_host="downloaders.lan"
|
||||
;;
|
||||
AI)
|
||||
target_host="ai.lan"
|
||||
;;
|
||||
authentik)
|
||||
target_host="auth.lan"
|
||||
;;
|
||||
cf)
|
||||
target_host="cf.lan"
|
||||
;;
|
||||
jellyfin)
|
||||
target_host="jf.lan"
|
||||
;;
|
||||
kasm)
|
||||
target_host="kasm.lan"
|
||||
;;
|
||||
netboot)
|
||||
target_host="netboot.lan"
|
||||
;;
|
||||
nexus)
|
||||
target_host="nexus.lan"
|
||||
;;
|
||||
pages)
|
||||
target_host="pages.lan"
|
||||
;;
|
||||
portainer)
|
||||
target_host="port.lan"
|
||||
;;
|
||||
twingate)
|
||||
target_host="twingate.lan"
|
||||
;;
|
||||
whisper)
|
||||
target_host="whisper.lan"
|
||||
;;
|
||||
# Add cases for other folders/hosts
|
||||
*)
|
||||
echo "Unknown folder: $folder"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
echo "::set-output name=target_host::$target_host"
|
||||
echo "::set-output name=folder::$folder"
|
||||
|
||||
sleep 45 # Delay for 45 seconds before fetching logs
|
||||
- name: Trigger AWX Job
|
||||
run: |
|
||||
TARGET_HOST="${{ steps.determine-host.outputs.target_host }}"
|
||||
FOLDER="${{ steps.determine-host.outputs.folder }}"
|
||||
echo "Triggering AWX Job with target host: $TARGET_HOST and folder: $FOLDER"
|
||||
curl -X POST -k -H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" \
|
||||
-d "{\"extra_vars\": {\"target_host\": \"$TARGET_HOST\", \"folder\": \"$FOLDER\"}}" \
|
||||
"https://awx.mafyuh.xyz/api/v2/job_templates/13/launch/"
|
||||
|
||||
job_id=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/job_templates/13/jobs/?order_by=-id | jq -r '.results[0].id')
|
||||
logs=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/?format=json)
|
||||
echo "AWX Job Logs for folder: $folder"
|
||||
echo "Range:"
|
||||
echo "Start: $(echo "$logs" | jq -r '.range.start')"
|
||||
echo "End: $(echo "$logs" | jq -r '.range.end')"
|
||||
echo "Absolute End: $(echo "$logs" | jq -r '.range.absolute_end')"
|
||||
echo "Content:"
|
||||
echo "$(echo "$logs" | jq -r '.content')"
|
||||
done
|
||||
- name: Delay for 45 seconds
|
||||
run: sleep 45
|
||||
|
||||
- name: Fetch AWX Job Logs
|
||||
run: |
|
||||
# Fetch the most recent job from AWX
|
||||
job_id=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/job_templates/13/jobs/?order_by=-id | jq -r '.results[0].id')
|
||||
|
||||
# Fetch the logs for the job
|
||||
logs=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/?format=json)
|
||||
|
||||
# Display the logs
|
||||
echo "Range:"
|
||||
echo "Start: $(echo "$logs" | jq -r '.range.start')"
|
||||
echo "End: $(echo "$logs" | jq -r '.range.end')"
|
||||
echo "Absolute End: $(echo "$logs" | jq -r '.range.absolute_end')"
|
||||
echo "Content:"
|
||||
echo "$(echo "$logs" | jq -r '.content')"
|
||||
|
|
|
@ -57,7 +57,7 @@ services:
|
|||
- PGID=1000
|
||||
|
||||
sonarr:
|
||||
image: ghcr.io/linuxserver/sonarr@sha256:275467ba17d990bbc6301dec3cc76b042969836749de39067818759d0f3b407f
|
||||
image: ghcr.io/linuxserver/sonarr@sha256:30432d9faf9e8fbb7c6336806ee061ed426204e1f9718d9659a2642a6e3a7c59
|
||||
container_name: sonarr
|
||||
ports:
|
||||
- "8989:8989"
|
||||
|
|
Reference in a new issue