Skip to content

Commit 89f8d7d

Browse files
author
Matt Reeves
committedJul 31, 2024
Merge branch 'main' into renovate/docker.mafyuh.xyz-ollama-ollama-0.x
2 parents 2fff249 + b509562 commit 89f8d7d

File tree

6 files changed

+53
-34
lines changed

6 files changed

+53
-34
lines changed
 

‎.forgejo/workflows/CD.yml

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,11 @@ jobs:
2222
fi
2323
folders=$(git diff --name-only HEAD~1 HEAD | grep '^docker/' | cut -d/ -f2 | sort | uniq)
2424
echo "Modified folders: $folders"
25-
echo "::set-output name=folders::$folders"
26-
27-
- name: Set condition for deployment
28-
id: set-condition
29-
run: |
30-
if [ -z "${{ steps.detect-changes.outputs.folders }}" ]; then
31-
echo "No relevant changes detected."
32-
echo "::set-output name=continue::false"
33-
else
34-
echo "Relevant changes detected."
35-
echo "::set-output name=continue::true"
36-
fi
37-
38-
conditional-deploy:
39-
if: needs.deploy.outputs.continue == 'true'
40-
runs-on: docker
41-
needs: deploy
42-
steps:
43-
- name: Checkout repository
44-
uses: actions/checkout@v4
25+
echo "::set-output name=folders::$folders"
4526
4627
- name: Deploy to hosts
4728
run: |
48-
IFS=' ' read -r -a folder_array <<< "${{ needs.deploy.outputs.folders }}"
29+
IFS=' ' read -r -a folder_array <<< "${{ steps.detect-changes.outputs.folders }}"
4930
for folder in "${folder_array[@]}"; do
5031
case $folder in
5132
arrs)
@@ -102,15 +83,12 @@ jobs:
10283
-d "{\"extra_vars\": {\"target_host\": \"$target_host\", \"folder\": \"$folder\"}}" \
10384
"https://awx.mafyuh.xyz/api/v2/job_templates/13/launch/"
10485
105-
sleep 45
106-
107-
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')
108-
logs=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/?format=json)
86+
sleep 45 # Delay for 45 seconds before fetching logs
87+
88+
job_id=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" "https://awx.mafyuh.xyz/api/v2/job_templates/13/jobs/?order_by=-id" | grep -oP '"id":\s*\K[0-9]+')
89+
logs=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" "https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/?format=json")
90+
10991
echo "AWX Job Logs for folder: $folder"
110-
echo "Range:"
111-
echo "Start: $(echo "$logs" | jq -r '.range.start')"
112-
echo "End: $(echo "$logs" | jq -r '.range.end')"
113-
echo "Absolute End: $(echo "$logs" | jq -r '.range.absolute_end')"
11492
echo "Content:"
115-
echo "$(echo "$logs" | jq -r '.content')"
93+
echo "$logs" | grep -oP '"content":\s*"\K[^"]+' | sed 's/\\n/\n/g'
11694
done

‎README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
# iac
2+
Currently migrating [Auto-Homelab](https://git.mafyuh.dev/mafyuh/Auto-Homelab), [Iac-Homelab](https://git.mafyuh.dev/mafyuh/IaC-Homelab), [ansible-playbooks](https://git.mafyuh.dev/mafyuh/ansible-playbooks) and [kub](https://git.mafyuh.dev/mafyuh/kub) repos into this one.
3+
4+
ToDo
5+
- [ ] Update Readme
6+
- [ ] Migrate all containers to use this repo (DB migrations)
7+
- [x] Get OpenTofu migrated to this repo
8+
- [ ] Get Kubernetes repo migrated over
9+
- [ ] Re-bootstrap Flux
210

‎ansible/playbooks/deploy-docker.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
- name: Deploy application
3+
hosts: "{{ target_host }}"
4+
vars:
5+
repo_path: "/home/{{ ansible_user }}/iac/docker/{{ folder }}"
6+
tasks:
7+
- name: Ensure the repository is up-to-date
8+
shell: git pull
9+
args:
10+
chdir: "{{ repo_path }}"
11+
register: git_pull_output
12+
13+
- name: Display git pull output
14+
debug:
15+
var: git_pull_output.stdout_lines
16+
17+
- name: Restart services
18+
command: docker compose up -d
19+
args:
20+
chdir: "{{ repo_path }}"
21+
register: docker_compose_output
22+
23+
- name: Display docker output
24+
debug:
25+
var: docker_compose_output.stdout_lines
26+
27+
- name: Run Docker Command
28+
command: docker ps
29+
register: docker_output
30+
31+
- name: Display Docker Output
32+
debug:
33+
var: docker_output.stdout_lines

‎docker/arrs/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ services:
3131
- PGID=1000
3232

3333
prowlarr:
34-
image: ghcr.io/linuxserver/prowlarr@sha256:7c3e7840c726828643131583514b66f38e7af29021d5a7b05ed8ed5c8ec0b596
34+
image: ghcr.io/linuxserver/prowlarr@sha256:9a98da4fb506278ce92c2fdbb4e08a38418dd1456e3dd8b3a1f00a42a8ec4fb0
3535
container_name: prowlarr
3636
ports:
3737
- "9696:9696"
@@ -91,7 +91,7 @@ services:
9191
- AUTH_OIDC_ADMIN_GROUP=${AUTH_OIDC_ADMIN_GROUP}
9292

9393
doplarr:
94-
image: ghcr.io/linuxserver/doplarr@sha256:b71ea85a718b4ed924f132c6a5e62ddef68a7f43ba137f4f30900067532a5d9a
94+
image: ghcr.io/linuxserver/doplarr@sha256:9e1cfedf824d00bb0f269bcb3836b13cdbb74747bef062f9021be6f0f63dde7a
9595
container_name: doplarr
9696
environment:
9797
- PUID=1000

‎docker/downloaders/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.9'
22
services:
33
sabnzbd:
4-
image: ghcr.io/linuxserver/sabnzbd@sha256:31ea64a7ce1e9a5ff8187f9b7c905eaa1d0a79d49b04724e47059c67407157eb
4+
image: ghcr.io/linuxserver/sabnzbd@sha256:d6a2a967d47b495c5342bc23de76d35eeb2f3ceb53c7be51885ad25f95dffe9b
55
container_name: sabnzbd
66
environment:
77
- PUID=1000

‎terraform/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<div align="center">
55

6-
# IaC-Homelab
6+
# IaC
77

88
Infrastructure as Code (IaC) for my homelab using OpenTofu.
99

0 commit comments

Comments
 (0)
Please sign in to comment.