Configure jenkins server as docker container.

This commit is contained in:
John Giannelos 2016-04-25 14:51:29 +01:00
Родитель 94a709897a
Коммит f161240e9b
4 изменённых файлов: 85 добавлений и 0 удалений

Просмотреть файл

@ -1,6 +1,7 @@
[tag_app_openvpn]
[tag_app_consul]
[tag_app_storage]
[tag_app_jenkins]
[openvpn:children]
tag_app_openvpn
@ -10,3 +11,6 @@ tag_app_consul
[storage:children]
tag_app_storage
[jenkins:children]
tag_app_jenkins

Просмотреть файл

@ -0,0 +1,55 @@
---
- name: Add docker deb repository keys
apt_key:
keyserver: p80.pool.sks-keyservers.net
id: "58118E89F3A912897C070ADBF76221572C52609D"
tags:
- jenkins
- name: Update repository cache
apt:
update_cache: yes
cache_valid_time: 3600
tags:
- jenkins
- name: Install apt dependencies
apt:
name: docker
state: present
tags:
- jenkins
- name: Ensure jenkins volume folder exists
file:
path: "/opt/jenkins"
state: directory
tags:
- jenkins
- name: Run jenkins docker
docker:
name: jenkins
image: partinfra/jenkins
state: started
ports:
- "80:8080"
- "5000:5000"
volumes:
- "/opt/jenkins:/var/jenkins_home"
restart_policy: always
tags:
- jenkins
- name: Setup consul service and check definitions
template:
src: consul.json.j2
dest: /etc/consul.d/jenkins.json
owner: root
group: root
mode: 0644
notify:
- restart consul
tags:
- jenkins
- consul

Просмотреть файл

@ -0,0 +1,19 @@
{
"services": [
{
"name": "jenkins",
"id": "jenkins-{{ ec2_id }}",
"tags": ["jenkins", "{{ ec2_tag_env }}"],
"port": 80,
"enableTagOverride": false,
"checks": [
{
"id": "jenkins-{{ ec2_id }}",
"name": "Jenkins on port 80",
"http": "http://{{ ansible_default_ipv4['address'] }}",
"interval": "10s",
"timeout": "4s"
}
]
}
]}

Просмотреть файл

@ -57,3 +57,10 @@
marathon_gluster_mountpoint: '/srv/marathon'
tags:
- mesos-slave
- hosts: jenkins
sudo: yes
roles:
- jenkins
tags:
- jenkins