Compare commits

..

16 commits

Author SHA1 Message Date
d6c6a84cfd Merge branch 'main' into renovate/ghcr.io-linuxserver-sabnzbd
Some checks failed
Lint on PR / Lint YAML files (pull_request) Successful in 4s
Deploy to Hosts / deploy (pull_request) Failing after 50s
2024-07-30 20:43:05 -04:00
849a40395a Update .forgejo/workflows/CD.yml 2024-07-30 20:37:13 -04:00
28e4391c85 Update .forgejo/workflows/CD.yml 2024-07-30 20:37:04 -04:00
7bca24ef86 Update ansible/playbooks/deploy-docker.yml 2024-07-30 20:33:00 -04:00
0807cd4e6f Merge pull request '⬆️ Update ghcr.io/linuxserver/doplarr Docker digest to 9e1cfed' (#34) from renovate/ghcr.io-linuxserver-doplarr into main
Reviewed-on: #34
2024-07-30 20:29:41 -04:00
21d7ce475e Merge branch 'main' into renovate/ghcr.io-linuxserver-doplarr
Some checks failed
Lint on PR / Lint YAML files (pull_request) Successful in 5s
Deploy to Hosts / deploy (pull_request) Failing after 49s
2024-07-30 20:29:29 -04:00
fdb00df7c4 Update .forgejo/workflows/CD.yml 2024-07-30 20:29:19 -04:00
ca828730a2 Merge pull request '⬆️ Update ghcr.io/linuxserver/prowlarr Docker digest to 9a98da4' (#42) from renovate/ghcr.io-linuxserver-prowlarr into main
Reviewed-on: #42
2024-07-30 20:26:06 -04:00
1c920c087b Merge branch 'main' into renovate/ghcr.io-linuxserver-prowlarr
Some checks failed
Lint on PR / Lint YAML files (pull_request) Successful in 5s
Deploy to Hosts / deploy (pull_request) Has been cancelled
2024-07-30 20:25:26 -04:00
718188d573 Update README.md 2024-07-30 20:24:14 -04:00
01bf777f5c Add ansible/playbooks/deploy-docker.yml 2024-07-30 20:20:04 -04:00
ee5b607785 Update .forgejo/workflows/CD.yml 2024-07-30 20:17:39 -04:00
949eb7e163 Update terraform/README.md 2024-07-29 21:13:32 -04:00
74ac4263c9 Update README.md 2024-07-29 21:10:51 -04:00
50c01e9e44 ⬆️ Update ghcr.io/linuxserver/doplarr Docker digest to 9e1cfed
All checks were successful
Lint on PR / Lint YAML files (pull_request) Successful in 6s
2024-07-28 09:01:11 +00:00
f2fe90f4c6 ⬆️ Update ghcr.io/linuxserver/prowlarr Docker digest to 9a98da4
All checks were successful
Lint on PR / Lint YAML files (pull_request) Successful in 9s
2024-07-27 00:01:04 +00:00
5 changed files with 52 additions and 33 deletions

View file

@ -24,28 +24,9 @@ jobs:
echo "Modified folders: $folders" echo "Modified folders: $folders"
echo "::set-output name=folders::$folders" echo "::set-output name=folders::$folders"
- name: Set condition for deployment
id: set-condition
run: |
if [ -z "${{ steps.detect-changes.outputs.folders }}" ]; then
echo "No relevant changes detected."
echo "::set-output name=continue::false"
else
echo "Relevant changes detected."
echo "::set-output name=continue::true"
fi
conditional-deploy:
if: needs.deploy.outputs.continue == 'true'
runs-on: docker
needs: deploy
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Deploy to hosts - name: Deploy to hosts
run: | run: |
IFS=' ' read -r -a folder_array <<< "${{ needs.deploy.outputs.folders }}" IFS=' ' read -r -a folder_array <<< "${{ steps.detect-changes.outputs.folders }}"
for folder in "${folder_array[@]}"; do for folder in "${folder_array[@]}"; do
case $folder in case $folder in
arrs) arrs)
@ -102,15 +83,12 @@ jobs:
-d "{\"extra_vars\": {\"target_host\": \"$target_host\", \"folder\": \"$folder\"}}" \ -d "{\"extra_vars\": {\"target_host\": \"$target_host\", \"folder\": \"$folder\"}}" \
"https://awx.mafyuh.xyz/api/v2/job_templates/13/launch/" "https://awx.mafyuh.xyz/api/v2/job_templates/13/launch/"
sleep 45 sleep 45 # Delay for 45 seconds before fetching logs
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]+')
logs=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" "https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/?format=json")
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 "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 "Content:"
echo "$(echo "$logs" | jq -r '.content')" echo "$logs" | grep -oP '"content":\s*"\K[^"]+' | sed 's/\\n/\n/g'
done done

View file

@ -1,2 +1,10 @@
# iac # iac
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.
ToDo
- [ ] Update Readme
- [ ] Migrate all containers to use this repo (DB migrations)
- [x] Get OpenTofu migrated to this repo
- [ ] Get Kubernetes repo migrated over
- [ ] Re-bootstrap Flux

View file

@ -0,0 +1,33 @@
---
- name: Deploy application
hosts: "{{ target_host }}"
vars:
repo_path: "/home/{{ ansible_user }}/iac/docker/{{ folder }}"
tasks:
- name: Ensure the repository is up-to-date
shell: git pull
args:
chdir: "{{ repo_path }}"
register: git_pull_output
- name: Display git pull output
debug:
var: git_pull_output.stdout_lines
- name: Restart services
command: docker compose up -d
args:
chdir: "{{ repo_path }}"
register: docker_compose_output
- name: Display docker output
debug:
var: docker_compose_output.stdout_lines
- name: Run Docker Command
command: docker ps
register: docker_output
- name: Display Docker Output
debug:
var: docker_output.stdout_lines

View file

@ -31,7 +31,7 @@ services:
- PGID=1000 - PGID=1000
prowlarr: prowlarr:
image: ghcr.io/linuxserver/prowlarr@sha256:7c3e7840c726828643131583514b66f38e7af29021d5a7b05ed8ed5c8ec0b596 image: ghcr.io/linuxserver/prowlarr@sha256:9a98da4fb506278ce92c2fdbb4e08a38418dd1456e3dd8b3a1f00a42a8ec4fb0
container_name: prowlarr container_name: prowlarr
ports: ports:
- "9696:9696" - "9696:9696"
@ -91,7 +91,7 @@ services:
- AUTH_OIDC_ADMIN_GROUP=${AUTH_OIDC_ADMIN_GROUP} - AUTH_OIDC_ADMIN_GROUP=${AUTH_OIDC_ADMIN_GROUP}
doplarr: doplarr:
image: ghcr.io/linuxserver/doplarr@sha256:b71ea85a718b4ed924f132c6a5e62ddef68a7f43ba137f4f30900067532a5d9a image: ghcr.io/linuxserver/doplarr@sha256:9e1cfedf824d00bb0f269bcb3836b13cdbb74747bef062f9021be6f0f63dde7a
container_name: doplarr container_name: doplarr
environment: environment:
- PUID=1000 - PUID=1000

View file

@ -3,7 +3,7 @@
<div align="center"> <div align="center">
# IaC-Homelab # IaC
Infrastructure as Code (IaC) for my homelab using OpenTofu. Infrastructure as Code (IaC) for my homelab using OpenTofu.