A smallish container based on alpine providing ansible support to drive infrastructure from inside a container.
Deploying from CI/CD through gitlab you need lightweight tools to push code around or drive various processes, Using this container allows for easy orchestration of complex systems driven through code.
docker run -it -v ${PWD}:/deployment -w /deployment terzom/ansible-deploy sh
variables:
keyfile: /tmp/ssh_private.key
ANSIBLE_HOST_KEY_CHECKING: "False"
stages:
- sanity
- deploy
deploy_syntax:
stage: sanity
image: terzom/ansible-deploy
script:
- cd deploy
- ansible-lint *.yml
deploy:
environment: production
stage: deploy
image: terzom/ansible-deploy
before_script:
# PRIVATE_KEY is a Secret variable inside gitlab
# https://gitlab.com/help/ci/variables/README.md#secret-variables
- echo "${PRIVATE_KEY}" | tr -d '\r' > ${keyfile}
- chmod 600 ${keyfile}
script:
- cd deploy
# ansbile.cfg and invntory are in the deploy directory
# of project.
- ansible-playbook -l production deploy.yml
The code in this repository, unless otherwise noted, is GNU licensed. See the LICENSE file in this repository.