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).
+- OS: Debian (jessie, wheezy), Ubuntu (trusty, precise), CentOS (6)
- Ansible: usually the latest version.
- `williamyeh/ansible:debian7`
- `williamyeh/ansible:ubuntu14.04`
- `williamyeh/ansible:ubuntu12.04`
+ - `williamyeh/ansible:centos6`
- onbuild series:
- `williamyeh/ansible:debian7-onbuild`
- `williamyeh/ansible:ubuntu14.04-onbuild`
- `williamyeh/ansible:ubuntu12.04-onbuild`
+ - `williamyeh/ansible:centos6-onbuild`
## Why yet another Ansible image for Docker?
config.vm.box = "ubuntu/trusty64"
#config.vm.box = "hashicorp/precise64"
#config.vm.box = "chef/debian-7.8"
+ #config.vm.box = "chef/centos-6.6"
+
# ==> Executing Ansible...
config.vm.provision "ansible" do |ansible|
#FROM williamyeh/ansible:ubuntu12.04
#FROM williamyeh/ansible:debian8
#FROM williamyeh/ansible:debian7
+#FROM williamyeh/ansible:centos6
# ==> Copying Ansible playbook...
#FROM williamyeh/ansible:ubuntu12.04-onbuild
#FROM williamyeh/ansible:debian8-onbuild
#FROM williamyeh/ansible:debian7-onbuild
+#FROM williamyeh/ansible:centos6-onbuild
# ==> Specify playbook filename; default = "playbook.yml"
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: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:centos6-onbuild centos6-onbuild
SHELL
end
--- /dev/null
+# Dockerfile for building Ansible image for CentOS 6, 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:centos6
+
+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 6, 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:centos6
+
+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" ]