From f2fe90f4c63777993aeaa4edc1cfc014a07248c0 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 27 Jul 2024 00:01:04 +0000 Subject: [PATCH 1/7] :arrow_up: Update ghcr.io/linuxserver/prowlarr Docker digest to 9a98da4 --- docker/arrs/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/arrs/docker-compose.yml b/docker/arrs/docker-compose.yml index 0fa4c92..2690fc3 100644 --- a/docker/arrs/docker-compose.yml +++ b/docker/arrs/docker-compose.yml @@ -31,7 +31,7 @@ services: - PGID=1000 prowlarr: - image: ghcr.io/linuxserver/prowlarr@sha256:7c3e7840c726828643131583514b66f38e7af29021d5a7b05ed8ed5c8ec0b596 + image: ghcr.io/linuxserver/prowlarr@sha256:9a98da4fb506278ce92c2fdbb4e08a38418dd1456e3dd8b3a1f00a42a8ec4fb0 container_name: prowlarr ports: - "9696:9696" From 74ac4263c9a19c528e6cb6474d640fb3ff7420b5 Mon Sep 17 00:00:00 2001 From: mafyuh Date: Mon, 29 Jul 2024 21:10:51 -0400 Subject: [PATCH 2/7] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index e032c68..d98f9d6 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,8 @@ # iac +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 From 949eb7e1634584786a973ee5341579ca66056f5b Mon Sep 17 00:00:00 2001 From: mafyuh Date: Mon, 29 Jul 2024 21:13:32 -0400 Subject: [PATCH 3/7] Update terraform/README.md --- terraform/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/README.md b/terraform/README.md index 9516ef2..8239517 100644 --- a/terraform/README.md +++ b/terraform/README.md @@ -3,7 +3,7 @@
-# IaC-Homelab +# IaC Infrastructure as Code (IaC) for my homelab using OpenTofu. From ee5b607785513a5544c4c0f3b6a5416a9e580e89 Mon Sep 17 00:00:00 2001 From: mafyuh Date: Tue, 30 Jul 2024 20:17:39 -0400 Subject: [PATCH 4/7] Update .forgejo/workflows/CD.yml --- .forgejo/workflows/CD.yml | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/.forgejo/workflows/CD.yml b/.forgejo/workflows/CD.yml index 0148346..dd619a4 100644 --- a/.forgejo/workflows/CD.yml +++ b/.forgejo/workflows/CD.yml @@ -6,7 +6,7 @@ on: jobs: deploy: if: github.event.pull_request.merged == true - runs-on: docker + runs-on: ubuntu-22.04 steps: - name: Checkout repository uses: actions/checkout@v4 @@ -22,30 +22,11 @@ jobs: fi folders=$(git diff --name-only HEAD~1 HEAD | grep '^docker/' | cut -d/ -f2 | sort | uniq) echo "Modified 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 + echo "::set-output name=folders::$folders" - name: Deploy to hosts 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 case $folder in arrs) @@ -102,8 +83,8 @@ jobs: -d "{\"extra_vars\": {\"target_host\": \"$target_host\", \"folder\": \"$folder\"}}" \ "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 | 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" @@ -113,4 +94,4 @@ jobs: echo "Absolute End: $(echo "$logs" | jq -r '.range.absolute_end')" echo "Content:" echo "$(echo "$logs" | jq -r '.content')" - done + done From 01bf777f5cb23bcd2a4e4dd9f74c1ea6ded902f8 Mon Sep 17 00:00:00 2001 From: mafyuh Date: Tue, 30 Jul 2024 20:20:04 -0400 Subject: [PATCH 5/7] Add ansible/playbooks/deploy-docker.yml --- ansible/playbooks/deploy-docker.yml | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 ansible/playbooks/deploy-docker.yml diff --git a/ansible/playbooks/deploy-docker.yml b/ansible/playbooks/deploy-docker.yml new file mode 100644 index 0000000..da06f3c --- /dev/null +++ b/ansible/playbooks/deploy-docker.yml @@ -0,0 +1,33 @@ +--- +- name: Deploy application + hosts: "{{ target_host }}" + vars: + repo_path: "/home/{{ ansible_user }}/iac/{{ 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 From 718188d5735678af783d978f1a0bd04bce6aa3c6 Mon Sep 17 00:00:00 2001 From: mafyuh Date: Tue, 30 Jul 2024 20:24:14 -0400 Subject: [PATCH 6/7] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d98f9d6..62f0588 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # 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 @@ -6,3 +7,4 @@ ToDo - [x] Get OpenTofu migrated to this repo - [ ] Get Kubernetes repo migrated over - [ ] Re-bootstrap Flux + From fdb00df7c44c8e716e717111ade0d254338757fa Mon Sep 17 00:00:00 2001 From: mafyuh Date: Tue, 30 Jul 2024 20:29:19 -0400 Subject: [PATCH 7/7] Update .forgejo/workflows/CD.yml --- .forgejo/workflows/CD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/CD.yml b/.forgejo/workflows/CD.yml index dd619a4..cfebdd5 100644 --- a/.forgejo/workflows/CD.yml +++ b/.forgejo/workflows/CD.yml @@ -6,7 +6,7 @@ on: jobs: deploy: if: github.event.pull_request.merged == true - runs-on: ubuntu-22.04 + runs-on: docker steps: - name: Checkout repository uses: actions/checkout@v4