Ansible in docker execution.
Current version:
ansible 2.8.5
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.7/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.7.3 (default, Mar 27 2019, 23:40:30) [GCC 6.3.0 20170516]
Usage example:
docker run --rm komivlad/ansible ansible --version
docker run --rm komivlad/ansible ansible-playbook -v
You can use it in gitlab runners, with docker gitlab-runner tagged.
Gitlab .gitlab-ci.yml example for update some_service configs via tags in gitlab (some_service_*):
stages:
- some_service_deploy_to_test
.base_some_service_deploy: &base_some_service_deploy
image: komivlad/ansible
when: manual
allow_failure: false
script:
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_KEY" | base64 -d)
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- ansible-playbook some_service.yml -b -l ${SERVER} --tags='reconfigure_some_service'
only:
- /some_service_.*/
some_service_deploy_to_test:
stage: some_service_deploy_to_test
<<: *base_some_service_deploy
variables:
SERVER: 'some_service_test01'
where,
$SSH_KEY - base64 encoded ssh private key, this variable should be added via gitlab ci variables.
$SERVER - some_service server hostname.
Content type
Image
Digest
Size
393.2 MB
Last updated
almost 7 years ago
docker pull komivlad/ansible