Init ansible runner
This commit is contained in:
29
misc/ansible-runner.sh
Normal file
29
misc/ansible-runner.sh
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Set pwd, don't expect to use
|
||||||
|
cd /home/ansible
|
||||||
|
|
||||||
|
# Ensure we have a log dir
|
||||||
|
mkdir -p /home/ansible/logs
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
rm -rf /home/ansible/infra
|
||||||
|
rm -rf /home/ansible/venv
|
||||||
|
|
||||||
|
# Clone the infra repo
|
||||||
|
git clone git@git.jthan.io:jonathan/infra /home/ansible/infra
|
||||||
|
|
||||||
|
# Create a venv
|
||||||
|
python3 -m venv /home/ansible/venv
|
||||||
|
|
||||||
|
# Source venv
|
||||||
|
. /home/ansible/venv/bin/activate
|
||||||
|
|
||||||
|
# Install requirements for ansible
|
||||||
|
pip install -r /home/ansible/infra/ansible/requirements.txt
|
||||||
|
|
||||||
|
# Change into ansible subdir of repo
|
||||||
|
cd /home/ansible/infra/ansible
|
||||||
|
|
||||||
|
# Run updates
|
||||||
|
ansible-playbook site.yaml >> /home/ansible/logs/runner.log
|
||||||
Reference in New Issue
Block a user