Last active
May 1, 2024 11:17
-
-
Save haxwithaxe/5f6d97f936cc5ebc71192b3c93fca218 to your computer and use it in GitHub Desktop.
A script to bootstrap ansible, run ansible-pull, and cleanup after
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| REPO="$1" | |
| shift | |
| BRANCH="${1:-main}" # Or commit or tag | |
| shift | |
| DEBIAN_NONINTERACTIVE=true | |
| apt update -y | |
| apt install --no-install-recommends --no-install-suggests -q -y python3-pip python3-venv git | |
| python3 -m venv /tmp/ansible-venv | |
| source /tmp/ansible-venv/bin/activate | |
| pip install ansible | |
| apt purge -y --autoremove python3-pip python3-venv | |
| ansible-pull -U "$REPO" -C "$BRANCH" $@ | |
| rm -rf /tmp/ansible-venv ~/.ansible |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment