Skip to content

Instantly share code, notes, and snippets.

@ptmt
Last active August 29, 2015 14:03
Show Gist options
  • Save ptmt/df8d3b0f91852d6bf369 to your computer and use it in GitHub Desktop.
Save ptmt/df8d3b0f91852d6bf369 to your computer and use it in GitHub Desktop.
Ansible playbook for install jenkins + mongo on docker
- hosts: ci
sudo: yes
tasks:
- name: Install Docker on Ubuntu
apt: pkg=docker.io state=present
- name: Rename docker.io to docker
shell: ln -sf /usr/bin/docker.io /usr/local/bin/docker
- name: Autocomplete available
shell: sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io
- name: Start Docker service
service: name=docker.io state=started
- name: Stop all containers
shell: docker stop $(docker ps -a -q)
- name: Remove all containers
shell: docker rm $(docker ps -a -q)
- name: Run mongo
shell: docker run --name jenkins-mongo -d mongo
- name: Run jenkins slave
shell: docker run guilhem/jenkins-slave --name slave -d
- name: Run jenkins
shell: docker run --name jenkins --link jenkins-mongo:mongo --link slave:slave -d -p 80:8080 -v /home/jenkins:/jenkins aespinosa/jenkins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment