From 04894aef9f9c0cdeab2d76c250040b303278b68f Mon Sep 17 00:00:00 2001 From: Maxim Vershinin Date: Tue, 18 Aug 2026 16:57:27 +0400 Subject: [PATCH 1/2] CHANGE: ensures pulls and updates before running jobs --- scripts/run_maintain_playbook.sh | 10 +++++----- scripts/update_modules.sh | 6 ------ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/scripts/run_maintain_playbook.sh b/scripts/run_maintain_playbook.sh index c677ec7..7ba9d2f 100755 --- a/scripts/run_maintain_playbook.sh +++ b/scripts/run_maintain_playbook.sh @@ -1,11 +1,11 @@ #!/bin/bash -LOCK_FILE=/tmp/vmn_ansible_lock_file.lock +# 1 - Pull the latest code +git pull origin main -while [ -f "$LOCK_FILE" ] -do - sleep 1s -done +# 2 - Update dependencies and modules +./scripts/update_modules.sh +# 3 - Run the job source .venv/bin/activate ansible-playbook playbooks/maintain.yaml --vault-pass-file ~/vault_password -i inventory/hosts.yaml --private-key ~/.ssh/ansible_key diff --git a/scripts/update_modules.sh b/scripts/update_modules.sh index d4f5f3b..fcfe312 100755 --- a/scripts/update_modules.sh +++ b/scripts/update_modules.sh @@ -1,8 +1,5 @@ #!/bin/bash -# Create a lock file to prevent other scripts from running with old modules -touch /tmp/vmn_ansible_lock_file.lock - source .venv/bin/activate # Install python packages @@ -13,6 +10,3 @@ ansible-galaxy collection install -r requirements.yaml -p ./collections/ # Install roles ansible-galaxy role install -r requirements.yaml -p ./roles/ - -# Installation is finished, remove the lock -rm /tmp/vmn_ansible_lock_file.lock From e9d38ece4d1b2a8f32b52c4543d13268a178d1e4 Mon Sep 17 00:00:00 2001 From: Maxim Vershinin Date: Tue, 18 Aug 2026 21:22:38 +0400 Subject: [PATCH 2/2] CHANGE: removes unnecessary steps from the gitea action --- .gitea/workflows/deploy_new_config.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.gitea/workflows/deploy_new_config.yaml b/.gitea/workflows/deploy_new_config.yaml index a338fe7..5c8e5c7 100644 --- a/.gitea/workflows/deploy_new_config.yaml +++ b/.gitea/workflows/deploy_new_config.yaml @@ -16,12 +16,6 @@ jobs: if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - - name: Trigger the webhook to start pulling the latest version from the repo - # LAN IP is used because those hosts are in the same network - run: curl "http://192.168.0.38:9000/hooks/pull-latest" - - - name: Trigger the webhook to update python and ansible modules - run: curl "http://192.168.0.38:9000/hooks/run-update-script" - - name: Trigger the webhook to run the playbook + # LAN IP is used because those hosts are in the same network run: curl "http://192.168.0.38:9000/hooks/run-maintain-playbook"