--- /dev/null
+install:
+ - curl -sLo - https://github.com/moul/travis-docker/raw/master/install.sh | sh -xe
+
+script:
+ - echo "==> Building the main Docker images..."
+ - ./run 'docker build -f centos6/Dockerfile -t ansible centos6 && docker run -i ansible > result-centos6'
+ - ./run 'docker build -f centos7/Dockerfile -t ansible centos7 && docker run -i ansible > result-centos7'
+ - ./run 'docker build -f debian7/Dockerfile -t ansible debian7 && docker run -i ansible > result-debian7'
+ - ./run 'docker build -f debian8/Dockerfile -t ansible debian8 && docker run -i ansible > result-debian8'
+ - ./run 'docker build -f ubuntu12.04/Dockerfile -t ansible ubuntu12.04 && docker run -i ansible > result-ubuntu12.04'
+ - ./run 'docker build -f ubuntu14.04/Dockerfile -t ansible ubuntu14.04 && docker run -i ansible > result-ubuntu14.04'
+ - ./run 'docker build -f centos6-onbuild/Dockerfile -t ansible centos6-onbuild && docker run -i ansible > result-centos6-onbuild'
+ - ./run 'docker build -f centos7-onbuild/Dockerfile -t ansible centos7-onbuild && docker run -i ansible > result-centos7-onbuild'
+ - ./run 'docker build -f debian7-onbuild/Dockerfile -t ansible debian7-onbuild && docker run -i ansible > result-debian7-onbuild'
+ - ./run 'docker build -f debian8-onbuild/Dockerfile -t ansible debian8-onbuild && docker run -i ansible > result-debian8-onbuild'
+ - ./run 'docker build -f ubuntu12.04-onbuild/Dockerfile -t ansible ubuntu12.04-onbuild && docker run -i ansible > result-ubuntu12.04-onbuild'
+ - ./run 'docker build -f ubuntu14.04-onbuild/Dockerfile -t ansible ubuntu14.04-onbuild && docker run -i ansible > result-ubuntu14.04-onbuild'
+
+
+ - echo "==> Validating the test results..."
+ - grep '^ansible-playbook' result-centos6 || exit 1
+ - grep '^ansible-playbook' result-centos7 || exit 1
+ - grep '^ansible-playbook' result-debian7 || exit 1
+ - grep '^ansible-playbook' result-debian8 || exit 1
+ - grep '^ansible-playbook' result-ubuntu12.04 || exit 1
+ - grep '^ansible-playbook' result-ubuntu14.04 || exit 1
+ - grep '^ansible-playbook' result-centos6-onbuild || exit 1
+ - grep '^ansible-playbook' result-centos7-onbuild || exit 1
+ - grep '^ansible-playbook' result-debian7-onbuild || exit 1
+ - grep '^ansible-playbook' result-debian8-onbuild || exit 1
+ - grep '^ansible-playbook' result-ubuntu12.04-onbuild || exit 1
+ - grep '^ansible-playbook' result-ubuntu14.04-onbuild || exit 1
Docker-Ansible base images
===================
+[![Build Status](https://travis-ci.org/William-Yeh/docker-ansible.svg?branch=master)](https://travis-ci.org/William-Yeh/docker-ansible)
+
## Summary
These are Docker images for [Ansible](https://github.com/ansible/ansible) software, installed in a selected Linux distributions.
-- OS: Debian (jessie, wheezy), Ubuntu (trusty, precise), CentOS (6)
+- OS: Debian (jessie, wheezy), Ubuntu (trusty, precise), CentOS (7, 6)
- Ansible: usually the latest version.
- `williamyeh/ansible:debian7`
- `williamyeh/ansible:ubuntu14.04`
- `williamyeh/ansible:ubuntu12.04`
+ - `williamyeh/ansible:centos7`
- `williamyeh/ansible:centos6`
- onbuild series:
- `williamyeh/ansible:debian7-onbuild`
- `williamyeh/ansible:ubuntu14.04-onbuild`
- `williamyeh/ansible:ubuntu12.04-onbuild`
+ - `williamyeh/ansible:centos7-onbuild`
- `williamyeh/ansible:centos6-onbuild`
config.vm.box = "ubuntu/trusty64"
#config.vm.box = "hashicorp/precise64"
#config.vm.box = "chef/debian-7.8"
+ #config.vm.box = "chef/centos-7.0"
#config.vm.box = "chef/centos-6.6"
#FROM williamyeh/ansible:ubuntu12.04
#FROM williamyeh/ansible:debian8
#FROM williamyeh/ansible:debian7
+#FROM williamyeh/ansible:centos7
#FROM williamyeh/ansible:centos6
#FROM williamyeh/ansible:ubuntu12.04-onbuild
#FROM williamyeh/ansible:debian8-onbuild
#FROM williamyeh/ansible:debian7-onbuild
+#FROM williamyeh/ansible:centos7-onbuild
#FROM williamyeh/ansible:centos6-onbuild
docker build -t ansible:ubuntu12.04 ubuntu12.04
docker build -t ansible:debian8 debian8
docker build -t ansible:debian7 debian7
- #docker build -t ansible:centos7 centos7
+ docker build -t ansible:centos7 centos7
docker build -t ansible:centos6 centos6
docker build -t ansible:ubuntu14.04-onbuild ubuntu14.04-onbuild
docker build -t ansible:ubuntu12.04-onbuild ubuntu12.04-onbuild
docker build -t ansible:debian8-onbuild debian8-onbuild
docker build -t ansible:debian7-onbuild debian7-onbuild
- #docker build -t ansible:centos7-onbuild centos7-onbuild
+ docker build -t ansible:centos7-onbuild centos7-onbuild
docker build -t ansible:centos6-onbuild centos6-onbuild
SHELL
--- /dev/null
+# Dockerfile for building Ansible image for CentOS 7, with as few additional software as possible.
+#
+# @see http://docs.ansible.com/intro_installation.html#latest-release-via-yum
+#
+# [NOTE] To fix the "sudo: sorry, you must have a tty to run sudo" issue,
+# we need to patch /etc/sudoers.
+# @see http://unix.stackexchange.com/questions/122616/why-do-i-need-a-tty-to-run-sudo-if-i-can-sudo-without-a-password
+# @see https://bugzilla.redhat.com/show_bug.cgi?id=1020147
+#
+# Version 1.0
+#
+
+
+# pull base image
+FROM centos:centos7
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Installing EPEL..." && \
+ yum -y install epel-release && \
+ \
+ \
+ echo "===> Installing Ansible..." && \
+ yum -y install ansible sudo && \
+ \
+ \
+ echo "===> Disabling sudo 'requiretty' setting..." && \
+ sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \
+ \
+ \
+ echo "===> Removing unused YUM resources..." && \
+ yum -y remove epel-release && \
+ yum clean all && \
+ \
+ \
+ echo "===> Adding hosts for convenience..." && \
+ mkdir -p /etc/ansible && \
+ echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+COPY ansible-playbook-wrapper /usr/local/bin/
+
+ONBUILD WORKDIR /tmp
+ONBUILD COPY . /tmp
+
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
--- /dev/null
+#!/bin/sh
+#
+# Simple wrapper for executing ansible-playbook with local connection.
+#
+# USAGE:
+# ansible-playbook-wrapper [other ansible-playbook arguments]
+#
+# ENVIRONMENT VARIABLES:
+#
+# - PLAYBOOK: playbook filename; default = "playbook.yml"
+# - INVENTORY: inventory filename; default = "/etc/ansible/hosts"
+#
+
+
+if [ -z "$PLAYBOOK" ]; then
+ PLAYBOOK=playbook.yml
+fi
+
+
+if [ -z "$INVENTORY" ]; then
+ exec ansible-playbook \
+ $PLAYBOOK \
+ --connection=local \
+ "$@"
+else
+ exec ansible-playbook \
+ -i $INVENTORY $PLAYBOOK \
+ --connection=local \
+ "$@"
+fi
--- /dev/null
+# Dockerfile for building Ansible image for CentOS 7, with as few additional software as possible.
+#
+# @see http://docs.ansible.com/intro_installation.html#latest-release-via-yum
+#
+# [NOTE] To fix the "sudo: sorry, you must have a tty to run sudo" issue,
+# we need to patch /etc/sudoers.
+# @see http://unix.stackexchange.com/questions/122616/why-do-i-need-a-tty-to-run-sudo-if-i-can-sudo-without-a-password
+# @see https://bugzilla.redhat.com/show_bug.cgi?id=1020147
+#
+# Version 1.0
+#
+
+
+# pull base image
+FROM centos:centos7
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Installing EPEL..." && \
+ yum -y install epel-release && \
+ \
+ \
+ echo "===> Installing Ansible..." && \
+ yum -y install ansible sudo && \
+ \
+ \
+ echo "===> Disabling sudo 'requiretty' setting..." && \
+ sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \
+ \
+ \
+ echo "===> Removing unused YUM resources..." && \
+ yum -y remove epel-release && \
+ yum clean all && \
+ \
+ \
+ echo "===> Adding hosts for convenience..." && \
+ mkdir -p /etc/ansible && \
+ echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]