Skip to content

Instantly share code, notes, and snippets.

@wicksome
Last active October 29, 2019 11:30
Show Gist options
  • Save wicksome/4b9b5b818cec4785ae48d1f794e7eec2 to your computer and use it in GitHub Desktop.
Save wicksome/4b9b5b818cec4785ae48d1f794e7eec2 to your computer and use it in GitHub Desktop.
Dockerfile: Jenkins with Ansible

Dockerfile: Jenkins with Ansible

FROM jenkins/jenkins:latest
LABEL maintainer="Yeongjun.kim <[email protected]>"
LABEL title="Docker with Ansible"
# https://github.com/ansible/ansible/releases
ARG ansible_version=2.8.6
USER root
RUN echo ${ansible_version}
RUN cd /root && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python get-pip.py --user && \
/root/.local/bin/pip install ansible==${ansible_version} && \
mkdir /etc/ansible
ENV ANSIBLE_VERSION=${ansible_version}
VOLUME ["/etc/ansible"]
USER jenkins
#/usr/bin/bash
docker-compose pull
docker-compose build --no-cache
[ $? -ne 0 ] && exit 1;
docker-compose down
docker-compose up -d
docker image prune -f
@wicksome
Copy link
Author

wicksome commented Oct 28, 2019

Show ansible/jenkins version

http://<<JENKINS_URL>>/systemInfo

image

Set ansible

  1. Install Ansible plugin: https://wiki.jenkins.io/display/JENKINS/Ansible+Plugin
  2. Set Ansible path to /usr/local/bin/: http://<JENKINS_URL>/configureTools/

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment