add CentOS 7

- CentOS 7 with Erlang 18.2 works
- CentOS 7 with default Erlang does not work yet
diff --git a/ansible/roles/debian-based/tasks/main.yml b/ansible/docker-inventories/centos-7-erlang-18
similarity index 88%
copy from ansible/roles/debian-based/tasks/main.yml
copy to ansible/docker-inventories/centos-7-erlang-18
index bd28a4b..10edf4c 100644
--- a/ansible/roles/debian-based/tasks/main.yml
+++ b/ansible/docker-inventories/centos-7-erlang-18
@@ -1,4 +1,5 @@
 # Licensed to the Apache Software Foundation (ASF) under one
+# Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
 # regarding copyright ownership.  The ASF licenses this file
@@ -15,4 +16,5 @@
 #   specific language governing permissions and limitations
 #   under the License.
 
-- include: dependencies.yml
+[centos-7-erlang-18]
+localhost
diff --git a/ansible/roles/debian-based/tasks/main.yml b/ansible/docker-inventories/centos-7-erlang-default
similarity index 88%
copy from ansible/roles/debian-based/tasks/main.yml
copy to ansible/docker-inventories/centos-7-erlang-default
index bd28a4b..5e87678 100644
--- a/ansible/roles/debian-based/tasks/main.yml
+++ b/ansible/docker-inventories/centos-7-erlang-default
@@ -1,4 +1,5 @@
 # Licensed to the Apache Software Foundation (ASF) under one
+# Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
 # regarding copyright ownership.  The ASF licenses this file
@@ -15,4 +16,5 @@
 #   specific language governing permissions and limitations
 #   under the License.
 
-- include: dependencies.yml
+[centos-7-erlang-default]
+localhost
diff --git a/ansible/roles/dependencies-centos/files/install-tl-unx.tar.gz b/ansible/roles/dependencies-centos/files/install-tl-unx.tar.gz
new file mode 100644
index 0000000..90df3c6
--- /dev/null
+++ b/ansible/roles/dependencies-centos/files/install-tl-unx.tar.gz
Binary files differ
diff --git a/ansible/roles/dependencies-centos/files/texlive.profile b/ansible/roles/dependencies-centos/files/texlive.profile
new file mode 100644
index 0000000..d0b6cf5
--- /dev/null
+++ b/ansible/roles/dependencies-centos/files/texlive.profile
@@ -0,0 +1,45 @@
+# texlive.profile written on Sun Feb  7 16:57:48 2016 UTC
+# It will NOT be updated and reflects only the
+# installation profile at installation time.
+selected_scheme scheme-custom
+TEXDIR /usr/local/texlive/2015
+TEXMFCONFIG ~/.texlive2015/texmf-config
+TEXMFHOME ~/texmf
+TEXMFLOCAL /usr/local/texlive/texmf-local
+TEXMFSYSCONFIG /usr/local/texlive/2015/texmf-config
+TEXMFSYSVAR /usr/local/texlive/2015/texmf-var
+TEXMFVAR ~/.texlive2015/texmf-var
+binary_x86_64-linux 1
+collection-basic 1
+collection-binextra 1
+collection-context 1
+collection-fontsrecommended 1
+collection-fontutils 1
+collection-genericrecommended 1
+collection-langenglish 1
+collection-latex 1
+collection-latexrecommended 1
+collection-luatex 1
+collection-mathextra 1
+collection-metapost 1
+collection-plainextra 1
+collection-xetex 1
+in_place 0
+option_adjustrepo 1
+option_autobackup 1
+option_backupdir tlpkg/backups
+option_desktop_integration 1
+option_doc 1
+option_file_assocs 1
+option_fmt 1
+option_letter 0
+option_menu_integration 1
+option_path 1
+option_post_code 1
+option_src 1
+option_sys_bin /usr/local/bin
+option_sys_info /usr/local/info
+option_sys_man /usr/local/man
+option_w32_multi_user 1
+option_write18_restricted 1
+portable 0
diff --git a/ansible/roles/dependencies-centos/tasks/main.yml b/ansible/roles/dependencies-centos/tasks/main.yml
new file mode 100644
index 0000000..a06d6fb
--- /dev/null
+++ b/ansible/roles/dependencies-centos/tasks/main.yml
@@ -0,0 +1,78 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing,
+#   software distributed under the License is distributed on an
+#   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#   KIND, either express or implied.  See the License for the
+#   specific language governing permissions and limitations
+#   under the License.
+
+- name: install auxiliary packages
+  yum: name={{item}} state=present update_cache=yes
+  with_items:
+  - '"@Development tools"'
+  - git
+  - wget
+  - which
+
+# dependencies for make couch, except erlang
+- name: install packages required to build CouchDB
+  yum: name={{item}} state=present
+  with_items:
+  - autoconf
+  - autoconf-archive
+  - automake
+  - curl-devel
+  - libicu-devel
+  - libtool
+
+- name: install nodejs 4.x
+  yum:
+    name: "https://rpm.nodesource.com/pub_4.x/el/7/x86_64/nodejs-4.2.6-1nodesource.el7.centos.x86_64.rpm"
+    state: present
+
+# download, compile and install Spidermonkey
+- include: spidermonkey.yml
+
+# download and install shunit2
+- include: shunit.yml
+
+# required for make docs
+- name: install packages required to build CouchDB
+  yum: name={{item}} state=present
+  with_items:
+  - help2man
+  - texinfo
+  - python-pip
+  - perl-Digest-MD5 # for texlive installer
+
+- name: install up to date version of sphinx via pip
+  shell: pip install sphinx==1.3.4
+
+- name: copy TeX Live installer
+  copy:
+    src: install-tl-unx.tar.gz
+    dest: /tmp/install-tl-unx.tar.gz
+- name: copy TeX Live installer profile
+  copy:
+    src: texlive.profile
+    dest: /tmp/texlive.profile
+- name: unpack TeX Live installer
+  unarchive:
+    src: /tmp/install-tl-unx.tar.gz
+    dest: /tmp
+    copy: no
+- name: install TeX Live via net installer
+  command: /tmp/install-tl-20160206/install-tl --profile=/tmp/texlive.profile
+  args:
+    chdir: /tmp/install-tl-20160206
+- name: install additional TeX packages
+  command: tlmgr install capt-of framed multirow needspace threeparttable titlesec upquote wrapfig
diff --git a/ansible/roles/debian-based/tasks/main.yml b/ansible/roles/dependencies-centos/tasks/shunit.yml
similarity index 65%
copy from ansible/roles/debian-based/tasks/main.yml
copy to ansible/roles/dependencies-centos/tasks/shunit.yml
index bd28a4b..93f8cb7 100644
--- a/ansible/roles/debian-based/tasks/main.yml
+++ b/ansible/roles/dependencies-centos/tasks/shunit.yml
@@ -15,4 +15,17 @@
 #   specific language governing permissions and limitations
 #   under the License.
 
-- include: dependencies.yml
+- name: download shunit2
+  get_url:
+    url: "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/shunit2/shunit2-2.1.6.tgz"
+    dest: /tmp/shunit2-2.1.6.tgz
+- name: unpack shunit2
+  unarchive:
+    src: /tmp/shunit2-2.1.6.tgz
+    dest: /opt
+    copy: no
+- name: link shunit2 script into PATH
+  file:
+    path: /usr/bin/shunit2
+    src: /opt/shunit2-2.1.6/src/shunit2
+    state: link
diff --git a/ansible/roles/dependencies-centos/tasks/spidermonkey.yml b/ansible/roles/dependencies-centos/tasks/spidermonkey.yml
new file mode 100644
index 0000000..27c8e03
--- /dev/null
+++ b/ansible/roles/dependencies-centos/tasks/spidermonkey.yml
@@ -0,0 +1,55 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing,
+#   software distributed under the License is distributed on an
+#   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#   KIND, either express or implied.  See the License for the
+#   specific language governing permissions and limitations
+#   under the License.
+
+- name: download Spidermonkey 1.8.5
+  get_url:
+    url: "http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz"
+    dest: /tmp/js185-1.0.0.tar.gz
+- name: unpack Spidermonkey 1.8.5
+  unarchive:
+    src: /tmp/js185-1.0.0.tar.gz
+    dest: /opt
+    copy: no
+- name: configure Spidermonkey 1.8.5
+  command: ./configure
+  args:
+    chdir: /opt/js-1.8.5/js/src
+- name: make Spidermonkey 1.8.5
+  command: make
+  args:
+    chdir: /opt/js-1.8.5/js/src
+- name: make install Spidermonkey 1.8.5
+  command: make install
+  args:
+    chdir: /opt/js-1.8.5/js/src
+
+# This prevents
+# error while loading shared libraries:
+# libmozjs185.so.1.0: cannot open shared object file
+# during CouchDB make later.
+- name: set LD_LIBRARY_PATH (otherwise libmozjs185.so.1.0 is not found)
+  copy:
+    content: "export LD_LIBRARY_PATH=/usr/local/lib"
+    dest: /etc/profile.d/library_path.sh
+
+# add symbolic link (otherwise CouchDB make complains about not being able to
+# find jsapi.h)
+- name: link /usr/include/js to /usr/local/include/js
+  file:
+    path: /usr/include/js
+    src: /usr/local/include/js
+    state: link
diff --git a/ansible/roles/debian-based/tasks/dependencies.yml b/ansible/roles/dependencies-debian/tasks/main.yml
similarity index 100%
rename from ansible/roles/debian-based/tasks/dependencies.yml
rename to ansible/roles/dependencies-debian/tasks/main.yml
diff --git a/ansible/roles/debian-based/tasks/main.yml b/ansible/roles/erlang-18-centos/tasks/main.yml
similarity index 82%
copy from ansible/roles/debian-based/tasks/main.yml
copy to ansible/roles/erlang-18-centos/tasks/main.yml
index bd28a4b..ba6a9c9 100644
--- a/ansible/roles/debian-based/tasks/main.yml
+++ b/ansible/roles/erlang-18-centos/tasks/main.yml
@@ -15,4 +15,6 @@
 #   specific language governing permissions and limitations
 #   under the License.
 
-- include: dependencies.yml
+- name: download and install Erlang 18
+  yum:
+    name: "https://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_18.2-1~centos~6_amd64.rpm"
diff --git a/ansible/roles/erlang-18/tasks/main.yml b/ansible/roles/erlang-18-debian/tasks/main.yml
similarity index 100%
rename from ansible/roles/erlang-18/tasks/main.yml
rename to ansible/roles/erlang-18-debian/tasks/main.yml
diff --git a/ansible/roles/debian-based/tasks/main.yml b/ansible/roles/erlang-default-centos/tasks/main.yml
similarity index 70%
copy from ansible/roles/debian-based/tasks/main.yml
copy to ansible/roles/erlang-default-centos/tasks/main.yml
index bd28a4b..dfe0a8b 100644
--- a/ansible/roles/debian-based/tasks/main.yml
+++ b/ansible/roles/erlang-default-centos/tasks/main.yml
@@ -15,4 +15,17 @@
 #   specific language governing permissions and limitations
 #   under the License.
 
-- include: dependencies.yml
+- name: install default Erlang version
+  yum: name={{item}} state=present
+  with_items:
+  - erlang-asn1
+  - erlang-erts
+  - erlang-os_mon
+  - erlang-xmerl
+
+# required for make check and make dialyze
+- name: install packages required to build CouchDB
+  yum: name={{item}} state=present
+  with_items:
+  - erlang-eunit
+  - erlang-dialyzer
diff --git a/ansible/roles/erlang-default/tasks/main.yml b/ansible/roles/erlang-default-debian/tasks/main.yml
similarity index 100%
rename from ansible/roles/erlang-default/tasks/main.yml
rename to ansible/roles/erlang-default-debian/tasks/main.yml
diff --git a/ansible/site.yml b/ansible/site.yml
index 785a1da..3bf6acf 100644
--- a/ansible/site.yml
+++ b/ansible/site.yml
@@ -15,31 +15,20 @@
 #   specific language governing permissions and limitations
 #   under the License.
 
-- hosts: ubuntu-14.04-erlang-18
+- hosts: centos-7-erlang-default
   remote_user: root
   roles:
-  - ubuntu-1404
-  - nodesource.node
-  - debian-based
-  - erlang-18
+  - geerlingguy.repo-epel
+  - dependencies-centos
+  - erlang-default-centos
   - common
 
-- hosts: ubuntu-14.04-erlang-default
+- hosts: centos-7-erlang-18
   remote_user: root
   roles:
-  - ubuntu-1404
-  - nodesource.node
-  - debian-based
-  - erlang-default
-  - common
-
-- hosts: debian-8-erlang-18
-  remote_user: root
-  roles:
-  - debian-8
-  - nodesource.node
-  - debian-based
-  - erlang-18
+  - geerlingguy.repo-epel
+  - dependencies-centos
+  - erlang-18-centos
   - common
 
 - hosts: debian-8-erlang-default
@@ -47,6 +36,33 @@
   roles:
   - debian-8
   - nodesource.node
-  - debian-based
-  - erlang-default
+  - dependencies-debian
+  - erlang-default-debian
+  - common
+
+- hosts: debian-8-erlang-18
+  remote_user: root
+  roles:
+  - debian-8
+  - nodesource.node
+  - dependencies-debian
+  - erlang-18-debian
+  - common
+
+- hosts: ubuntu-14.04-erlang-default
+  remote_user: root
+  roles:
+  - ubuntu-1404
+  - nodesource.node
+  - dependencies-debian
+  - erlang-default-debian
+  - common
+
+- hosts: ubuntu-14.04-erlang-18
+  remote_user: root
+  roles:
+  - ubuntu-1404
+  - nodesource.node
+  - dependencies-debian
+  - erlang-18-debian
   - common
diff --git a/ansible/roles/debian-based/tasks/main.yml b/bin/centos-7-erlang-18/create-container.sh
old mode 100644
new mode 100755
similarity index 70%
copy from ansible/roles/debian-based/tasks/main.yml
copy to bin/centos-7-erlang-18/create-container.sh
index bd28a4b..2254c7d
--- a/ansible/roles/debian-based/tasks/main.yml
+++ b/bin/centos-7-erlang-18/create-container.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -15,4 +17,12 @@
 #   specific language governing permissions and limitations
 #   under the License.
 
-- include: dependencies.yml
+set -e
+
+# The Docker containers need the root directory of this repository as their
+# build context (because they need the Ansible files).
+pushd `dirname $0`/../.. > /dev/null
+
+docker build -f docker/centos-7-erlang-18/Dockerfile -t basti1302/couchdb-build-centos-7-erlang-18.2 .
+
+popd > /dev/null
diff --git a/ansible/roles/debian-based/tasks/main.yml b/bin/centos-7-erlang-18/enter-container.sh
old mode 100644
new mode 100755
similarity index 89%
copy from ansible/roles/debian-based/tasks/main.yml
copy to bin/centos-7-erlang-18/enter-container.sh
index bd28a4b..0063436
--- a/ansible/roles/debian-based/tasks/main.yml
+++ b/bin/centos-7-erlang-18/enter-container.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -15,4 +17,4 @@
 #   specific language governing permissions and limitations
 #   under the License.
 
-- include: dependencies.yml
+docker run -it basti1302/couchdb-build-centos-7-erlang-18.2 bash
diff --git a/ansible/roles/debian-based/tasks/main.yml b/bin/centos-7-erlang-18/publish-container.sh
old mode 100644
new mode 100755
similarity index 90%
rename from ansible/roles/debian-based/tasks/main.yml
rename to bin/centos-7-erlang-18/publish-container.sh
index bd28a4b..cd3044e
--- a/ansible/roles/debian-based/tasks/main.yml
+++ b/bin/centos-7-erlang-18/publish-container.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -15,4 +17,4 @@
 #   specific language governing permissions and limitations
 #   under the License.
 
-- include: dependencies.yml
+docker push basti1302/couchdb-build-centos-7-erlang-18.2
diff --git a/ansible/roles/debian-based/tasks/main.yml b/bin/centos-7-erlang-18/run-build-in-container.sh
old mode 100644
new mode 100755
similarity index 86%
copy from ansible/roles/debian-based/tasks/main.yml
copy to bin/centos-7-erlang-18/run-build-in-container.sh
index bd28a4b..cc91386
--- a/ansible/roles/debian-based/tasks/main.yml
+++ b/bin/centos-7-erlang-18/run-build-in-container.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -15,4 +17,4 @@
 #   specific language governing permissions and limitations
 #   under the License.
 
-- include: dependencies.yml
+docker run -e LD_LIBRARY_PATH='/usr/local/lib' basti1302/couchdb-build-centos-7-erlang-18.2
diff --git a/ansible/roles/debian-based/tasks/main.yml b/bin/centos-7-erlang-default/create-container.sh
old mode 100644
new mode 100755
similarity index 70%
copy from ansible/roles/debian-based/tasks/main.yml
copy to bin/centos-7-erlang-default/create-container.sh
index bd28a4b..f93f581
--- a/ansible/roles/debian-based/tasks/main.yml
+++ b/bin/centos-7-erlang-default/create-container.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -15,4 +17,12 @@
 #   specific language governing permissions and limitations
 #   under the License.
 
-- include: dependencies.yml
+set -e
+
+# The Docker containers need the root directory of this repository as their
+# build context (because they need the Ansible files).
+pushd `dirname $0`/../.. > /dev/null
+
+docker build -f docker/centos-7-erlang-default/Dockerfile -t basti1302/couchdb-build-centos-7-erlang-default .
+
+popd > /dev/null
diff --git a/ansible/roles/debian-based/tasks/main.yml b/bin/centos-7-erlang-default/enter-container.sh
old mode 100644
new mode 100755
similarity index 89%
copy from ansible/roles/debian-based/tasks/main.yml
copy to bin/centos-7-erlang-default/enter-container.sh
index bd28a4b..064f232
--- a/ansible/roles/debian-based/tasks/main.yml
+++ b/bin/centos-7-erlang-default/enter-container.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -15,4 +17,4 @@
 #   specific language governing permissions and limitations
 #   under the License.
 
-- include: dependencies.yml
+docker run -it basti1302/couchdb-build-centos-7-erlang-default bash
diff --git a/ansible/roles/debian-based/tasks/main.yml b/bin/centos-7-erlang-default/publish-container.sh
old mode 100644
new mode 100755
similarity index 89%
copy from ansible/roles/debian-based/tasks/main.yml
copy to bin/centos-7-erlang-default/publish-container.sh
index bd28a4b..060dbe0
--- a/ansible/roles/debian-based/tasks/main.yml
+++ b/bin/centos-7-erlang-default/publish-container.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -15,4 +17,4 @@
 #   specific language governing permissions and limitations
 #   under the License.
 
-- include: dependencies.yml
+docker push basti1302/couchdb-build-centos-7-erlang-default
diff --git a/ansible/roles/debian-based/tasks/main.yml b/bin/centos-7-erlang-default/run-build-in-container.sh
old mode 100644
new mode 100755
similarity index 89%
copy from ansible/roles/debian-based/tasks/main.yml
copy to bin/centos-7-erlang-default/run-build-in-container.sh
index bd28a4b..6881835
--- a/ansible/roles/debian-based/tasks/main.yml
+++ b/bin/centos-7-erlang-default/run-build-in-container.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -15,4 +17,4 @@
 #   specific language governing permissions and limitations
 #   under the License.
 
-- include: dependencies.yml
+docker run basti1302/couchdb-build-centos-7-erlang-default
diff --git a/docker/centos-7-erlang-18/Dockerfile b/docker/centos-7-erlang-18/Dockerfile
new file mode 100644
index 0000000..330c124
--- /dev/null
+++ b/docker/centos-7-erlang-18/Dockerfile
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing,
+#   software distributed under the License is distributed on an
+#   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#   KIND, either express or implied.  See the License for the
+#   specific language governing permissions and limitations
+
+# NOTE: All docker files need to be run from ../../, that is
+# docker build -f /docker/<container>/Dockerfile
+
+# Base Image: Plain Vanilla CentOS with Ansible installed
+FROM williamyeh/ansible:centos7-onbuild
+
+# Add ansible directory and cd to it
+ADD ./ansible /ansible
+WORKDIR /ansible
+
+# Install Ansible roles
+RUN ansible-galaxy install geerlingguy.repo-epel
+RUN ansible-galaxy install nodesource.node
+
+# Run Ansible to provision container
+RUN ansible-playbook site.yml \
+  --connection=local \
+  --inventory-file=./docker-inventories/centos-7-erlang-18
+
+USER couchdb
+
+CMD ["/home/couchdb/build-ci.sh"]
diff --git a/docker/centos-7-erlang-default/Dockerfile b/docker/centos-7-erlang-default/Dockerfile
new file mode 100644
index 0000000..851ff1e
--- /dev/null
+++ b/docker/centos-7-erlang-default/Dockerfile
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing,
+#   software distributed under the License is distributed on an
+#   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#   KIND, either express or implied.  See the License for the
+#   specific language governing permissions and limitations
+
+# NOTE: All docker files need to be run from ../../, that is
+# docker build -f /docker/<container>/Dockerfile
+
+# Base Image: Plain Vanilla CentOS with Ansible installed
+FROM williamyeh/ansible:centos7-onbuild
+
+# Add ansible directory and cd to it
+ADD ./ansible /ansible
+WORKDIR /ansible
+
+# Install Ansible roles
+RUN ansible-galaxy install geerlingguy.repo-epel
+RUN ansible-galaxy install nodesource.node
+
+# Run Ansible to provision container
+RUN ansible-playbook site.yml \
+  --connection=local \
+  --inventory-file=./docker-inventories/centos-7-erlang-default
+
+# USER couchdb
+
+CMD ["/home/couchdb/build-ci.sh"]
diff --git a/docker/debian-8-erlang-18/Dockerfile b/docker/debian-8-erlang-18/Dockerfile
index 5455412..06d1f0f 100644
--- a/docker/debian-8-erlang-18/Dockerfile
+++ b/docker/debian-8-erlang-18/Dockerfile
@@ -24,7 +24,8 @@
 ADD ./ansible /ansible
 WORKDIR /ansible
 
-# Install Node.js role
+# Install Ansible roles
+RUN ansible-galaxy install geerlingguy.repo-epel
 RUN ansible-galaxy install nodesource.node
 
 # Run Ansible to provision container
diff --git a/docker/debian-8-erlang-default/Dockerfile b/docker/debian-8-erlang-default/Dockerfile
index 95bde23..aeeec08 100644
--- a/docker/debian-8-erlang-default/Dockerfile
+++ b/docker/debian-8-erlang-default/Dockerfile
@@ -24,7 +24,8 @@
 ADD ./ansible /ansible
 WORKDIR /ansible
 
-# Install Node.js role
+# Install Ansible roles
+RUN ansible-galaxy install geerlingguy.repo-epel
 RUN ansible-galaxy install nodesource.node
 
 # Run Ansible to provision container
diff --git a/docker/ubuntu-14.04-erlang-18/Dockerfile b/docker/ubuntu-14.04-erlang-18/Dockerfile
index f53b0bf..c1dceeb 100644
--- a/docker/ubuntu-14.04-erlang-18/Dockerfile
+++ b/docker/ubuntu-14.04-erlang-18/Dockerfile
@@ -24,7 +24,8 @@
 ADD ./ansible /ansible
 WORKDIR /ansible
 
-# Install Node.js role
+# Install Ansible roles
+RUN ansible-galaxy install geerlingguy.repo-epel
 RUN ansible-galaxy install nodesource.node
 
 # Run Ansible to provision container
diff --git a/docker/ubuntu-14.04-erlang-default/Dockerfile b/docker/ubuntu-14.04-erlang-default/Dockerfile
index 52db492..ad966a3 100644
--- a/docker/ubuntu-14.04-erlang-default/Dockerfile
+++ b/docker/ubuntu-14.04-erlang-default/Dockerfile
@@ -24,7 +24,8 @@
 ADD ./ansible /ansible
 WORKDIR /ansible
 
-# Install Node.js role
+# Install Ansible roles
+RUN ansible-galaxy install geerlingguy.repo-epel
 RUN ansible-galaxy install nodesource.node
 
 # Run Ansible to provision container
diff --git a/jenkins/build.sh b/jenkins/build.sh
index 4c515a3..a6e6754 100755
--- a/jenkins/build.sh
+++ b/jenkins/build.sh
@@ -39,14 +39,18 @@
 DOCKER_IMAGE="basti1302/couchdb-build-"
 
 case $OS in
-  ubuntu-14.04*)
-    echo "Using Ubuntu 14.04"
-    DOCKER_IMAGE=$DOCKER_IMAGE"ubuntu-14.04-"
+  centos-7*)
+    echo "Using CentOS 7"
+    DOCKER_IMAGE=$DOCKER_IMAGE"centos-7-"
     ;;
   debian-8*)
     echo "Using Debian 8"
     DOCKER_IMAGE=$DOCKER_IMAGE"debian-8-"
     ;;
+  ubuntu-14.04*)
+    echo "Using Ubuntu 14.04"
+    DOCKER_IMAGE=$DOCKER_IMAGE"ubuntu-14.04-"
+    ;;
   *)
     echo "Unknown OS $OS"
     exit 1
@@ -54,14 +58,14 @@
 esac
 
 case $ERLANG in
-  18.2*)
-    echo "Using Erlang 18.2"
-    DOCKER_IMAGE=$DOCKER_IMAGE"erlang-18.2"
-    ;;
   default*)
     echo "Using Erlang 18.2"
     DOCKER_IMAGE=$DOCKER_IMAGE"erlang-default"
     ;;
+  18.2*)
+    echo "Using Erlang 18.2"
+    DOCKER_IMAGE=$DOCKER_IMAGE"erlang-18.2"
+    ;;
   *)
     echo "Unknown Erlang version $ERLANG"
     exit 1
@@ -70,9 +74,4 @@
 
 docker pull $DOCKER_IMAGE
 
-# Set a trap to delete the image on exit.
-# trap "docker rmi $TAG" EXIT
-
-#--privileged ?
-#--rm ?
 docker run $DOCKER_IMAGE