Allow you to run Ansible on machines to configure them for your project
7.3K
Docker container allowing you to run Ansible on machines to configure them for your project. It can also be used to run Ansistrano to deploy your project somewhere.
This container targets deployment from GitLab CI but you can also use it by using docker's CLI. You will need to do the following in the container to make it work:
Dockerfile linksThe following softwares are installed:
gpg and sops for YAML secrets decryptionopenssh for ssh connection and key forwardingsops, etc.)Here is an example of GitLab CI configuration. This configuration should be considered more as an inspiration than a guideline and example of best practice:
stages:
- deploy
variables:
ANSIBLE_HOST_KEY_CHECKING: 'False'
deploy:production:
stage: deploy
image: vnvsa/deployer:latest
resource_group: production
when: manual
variables:
ANSIBLE_HOST_KEY_CHECKING: 'False'
target: production
environment:
name: production
url: https://<your hostname>
deployment_tier: production
before_script:
- eval $(ssh-agent -s)
- echo "$DEPLOYMENT_PRODUCTION_KEY" | base64 -d | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- ssh-keyscan <your hostname>
- make -C ansistrano install # install roles/collections required by Ansible (in "ansistrano" folder)
allow_failure: false
script:
- export USER="$GITLAB_USER_LOGIN via gitlab"
- make -C ansistrano deploy # Run deploy playbook (in "ansistrano" folder)
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_DEPLOY_FREEZE == null'
when: manual
allow_failure: false
- if: '$CI_COMMIT_TAG && $CI_DEPLOY_FREEZE == null'
when: manual
allow_failure: false
Content type
Image
Digest
sha256:ee08a2ed3…
Size
230.3 MB
Last updated
4 days ago
docker pull vnvsa/deployer