gableroux/asdjfbkjahsvfjahvsdfjahsdfjkhasvdf
Docker image to use ansible
and ssh
in a CI :+1:
docker run --rm -it gableroux/ansible:2.7.10 ansible --help
.ansible: &ansible
stage: deploy
when: manual
image: gableroux/ansible:2.7.10
before_script:
# https://docs.gitlab.com/ee/ci/ssh_keys/
- eval $(ssh-agent -s)
- mkdir ~/.ssh/
- chmod 700 ~/.ssh
- echo "$SSH_CONFIG" > ~/.ssh/config
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
deploy-example-master:
<<: *ansible
script:
- ansible --version
- ansible-playbook -i host-example deploy.yml
only:
- master
There is a script in scripts
that reads values from versions.txt
and runs required commands to push to the repository with tags and trigger docker hub. :v:
Installing with pip
is fine, but pulling this image is faster.
As described here in the short description:
Images for automated testing of Ansible. They do not include Ansible and are not for end users.
The official image is used to run tests for the ansible project. I wish they had and official image for actually running ansible.
Fork the project, replace ENV
and push your own image.
Yes, why not?
I don't trust people when it comes to running critical code against infrastructure. If you wish to use this, I recommend you to fork it and build your own. There are many good alternatives, notably William-Yeh/docker-ansible, but I found it was kind of big or doing too many things. Installing ansible is quite easy so I made a single image based on alpine so it's small. :)
I'm using docker's automated build
docker pull gableroux/asdjfbkjahsvfjahvsdfjahsdfjkhasvdf