CHANGE: ensures pulls and updates before running jobs
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
LOCK_FILE=/tmp/vmn_ansible_lock_file.lock
|
# 1 - Pull the latest code
|
||||||
|
git pull origin main
|
||||||
|
|
||||||
while [ -f "$LOCK_FILE" ]
|
# 2 - Update dependencies and modules
|
||||||
do
|
./scripts/update_modules.sh
|
||||||
sleep 1s
|
|
||||||
done
|
|
||||||
|
|
||||||
|
# 3 - Run the job
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
ansible-playbook playbooks/maintain.yaml --vault-pass-file ~/vault_password -i inventory/hosts.yaml --private-key ~/.ssh/ansible_key
|
ansible-playbook playbooks/maintain.yaml --vault-pass-file ~/vault_password -i inventory/hosts.yaml --private-key ~/.ssh/ansible_key
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/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
|
source .venv/bin/activate
|
||||||
|
|
||||||
# Install python packages
|
# Install python packages
|
||||||
@@ -13,6 +10,3 @@ ansible-galaxy collection install -r requirements.yaml -p ./collections/
|
|||||||
|
|
||||||
# Install roles
|
# Install roles
|
||||||
ansible-galaxy role install -r requirements.yaml -p ./roles/
|
ansible-galaxy role install -r requirements.yaml -p ./roles/
|
||||||
|
|
||||||
# Installation is finished, remove the lock
|
|
||||||
rm /tmp/vmn_ansible_lock_file.lock
|
|
||||||
|
|||||||
Reference in New Issue
Block a user