aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorWilliam Yeh <william.pjyeh@gmail.com>2015-04-28 21:17:57 +0800
committerWilliam Yeh <william.pjyeh@gmail.com>2015-04-28 21:17:57 +0800
commite6ab6feafb044b0e22914243686b2d8cf245a869 (patch)
tree53e8397a8694a38492cc5c4ed451fdc6155a8f6d
parentebfd2bf236ddaf7206dc77877dc9eb2d07a0dec9 (diff)
downloaddocker-ansible-e6ab6feafb044b0e22914243686b2d8cf245a869.tar.gz
docker-ansible-e6ab6feafb044b0e22914243686b2d8cf245a869.tar.zst
docker-ansible-e6ab6feafb044b0e22914243686b2d8cf245a869.zip
Add: support for CentOS 6.
-rw-r--r--README.md8
-rw-r--r--Vagrantfile4
-rw-r--r--centos6-onbuild/Dockerfile50
-rwxr-xr-xcentos6-onbuild/ansible-playbook-wrapper30
-rw-r--r--centos6/Dockerfile43
5 files changed, 134 insertions, 1 deletions
diff --git a/README.md b/README.md
index 7dce9f8..629ed7a 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ This repository contains Dockerized [Ansible](https://github.com/ansible/ansible
14 14
15These are Docker images for [Ansible](https://github.com/ansible/ansible) software, installed in a selected Linux distributions. 15These are Docker images for [Ansible](https://github.com/ansible/ansible) software, installed in a selected Linux distributions.
16 16
17- OS: Debian (jessie, wheezy), Ubuntu (trusty, precise). 17- OS: Debian (jessie, wheezy), Ubuntu (trusty, precise), CentOS (6)
18 18
19- Ansible: usually the latest version. 19- Ansible: usually the latest version.
20 20
@@ -27,6 +27,7 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa
27 - `williamyeh/ansible:debian7` 27 - `williamyeh/ansible:debian7`
28 - `williamyeh/ansible:ubuntu14.04` 28 - `williamyeh/ansible:ubuntu14.04`
29 - `williamyeh/ansible:ubuntu12.04` 29 - `williamyeh/ansible:ubuntu12.04`
30 - `williamyeh/ansible:centos6`
30 31
31- onbuild series: 32- onbuild series:
32 33
@@ -34,6 +35,7 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa
34 - `williamyeh/ansible:debian7-onbuild` 35 - `williamyeh/ansible:debian7-onbuild`
35 - `williamyeh/ansible:ubuntu14.04-onbuild` 36 - `williamyeh/ansible:ubuntu14.04-onbuild`
36 - `williamyeh/ansible:ubuntu12.04-onbuild` 37 - `williamyeh/ansible:ubuntu12.04-onbuild`
38 - `williamyeh/ansible:centos6-onbuild`
37 39
38 40
39## Why yet another Ansible image for Docker? 41## Why yet another Ansible image for Docker?
@@ -64,6 +66,8 @@ Vagrant.configure(2) do |config|
64 config.vm.box = "ubuntu/trusty64" 66 config.vm.box = "ubuntu/trusty64"
65 #config.vm.box = "hashicorp/precise64" 67 #config.vm.box = "hashicorp/precise64"
66 #config.vm.box = "chef/debian-7.8" 68 #config.vm.box = "chef/debian-7.8"
69 #config.vm.box = "chef/centos-6.6"
70
67 71
68 # ==> Executing Ansible... 72 # ==> Executing Ansible...
69 config.vm.provision "ansible" do |ansible| 73 config.vm.provision "ansible" do |ansible|
@@ -87,6 +91,7 @@ FROM williamyeh/ansible:ubuntu14.04
87#FROM williamyeh/ansible:ubuntu12.04 91#FROM williamyeh/ansible:ubuntu12.04
88#FROM williamyeh/ansible:debian8 92#FROM williamyeh/ansible:debian8
89#FROM williamyeh/ansible:debian7 93#FROM williamyeh/ansible:debian7
94#FROM williamyeh/ansible:centos6
90 95
91 96
92# ==> Copying Ansible playbook... 97# ==> Copying Ansible playbook...
@@ -111,6 +116,7 @@ FROM williamyeh/ansible:ubuntu14.04-onbuild
111#FROM williamyeh/ansible:ubuntu12.04-onbuild 116#FROM williamyeh/ansible:ubuntu12.04-onbuild
112#FROM williamyeh/ansible:debian8-onbuild 117#FROM williamyeh/ansible:debian8-onbuild
113#FROM williamyeh/ansible:debian7-onbuild 118#FROM williamyeh/ansible:debian7-onbuild
119#FROM williamyeh/ansible:centos6-onbuild
114 120
115 121
116# ==> Specify playbook filename; default = "playbook.yml" 122# ==> Specify playbook filename; default = "playbook.yml"
diff --git a/Vagrantfile b/Vagrantfile
index 4d8c0a6..1f16b40 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -8,11 +8,15 @@ Vagrant.configure(2) do |config|
8 docker build -t ansible:ubuntu12.04 ubuntu12.04 8 docker build -t ansible:ubuntu12.04 ubuntu12.04
9 docker build -t ansible:debian8 debian8 9 docker build -t ansible:debian8 debian8
10 docker build -t ansible:debian7 debian7 10 docker build -t ansible:debian7 debian7
11 #docker build -t ansible:centos7 centos7
12 docker build -t ansible:centos6 centos6
11 13
12 docker build -t ansible:ubuntu14.04-onbuild ubuntu14.04-onbuild 14 docker build -t ansible:ubuntu14.04-onbuild ubuntu14.04-onbuild
13 docker build -t ansible:ubuntu12.04-onbuild ubuntu12.04-onbuild 15 docker build -t ansible:ubuntu12.04-onbuild ubuntu12.04-onbuild
14 docker build -t ansible:debian8-onbuild debian8-onbuild 16 docker build -t ansible:debian8-onbuild debian8-onbuild
15 docker build -t ansible:debian7-onbuild debian7-onbuild 17 docker build -t ansible:debian7-onbuild debian7-onbuild
18 #docker build -t ansible:centos7-onbuild centos7-onbuild
19 docker build -t ansible:centos6-onbuild centos6-onbuild
16 20
17 SHELL 21 SHELL
18end 22end
diff --git a/centos6-onbuild/Dockerfile b/centos6-onbuild/Dockerfile
new file mode 100644
index 0000000..cb96493
--- /dev/null
+++ b/centos6-onbuild/Dockerfile
@@ -0,0 +1,50 @@
1# Dockerfile for building Ansible image for CentOS 6, with as few additional software as possible.
2#
3# @see http://docs.ansible.com/intro_installation.html#latest-release-via-yum
4#
5# [NOTE] To fix the "sudo: sorry, you must have a tty to run sudo" issue,
6# we need to patch /etc/sudoers.
7# @see http://unix.stackexchange.com/questions/122616/why-do-i-need-a-tty-to-run-sudo-if-i-can-sudo-without-a-password
8# @see https://bugzilla.redhat.com/show_bug.cgi?id=1020147
9#
10# Version 1.0
11#
12
13
14# pull base image
15FROM centos:centos6
16
17MAINTAINER William Yeh <william.pjyeh@gmail.com>
18
19
20RUN echo "===> Installing EPEL..." && \
21 yum -y install epel-release && \
22 \
23 \
24 echo "===> Installing Ansible..." && \
25 yum -y install ansible sudo && \
26 \
27 \
28 echo "===> Disabling sudo 'requiretty' setting..." && \
29 sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \
30 \
31 \
32 echo "===> Removing unused YUM resources..." && \
33 yum -y remove epel-release && \
34 yum clean all && \
35 \
36 \
37 echo "===> Adding hosts for convenience..." && \
38 mkdir -p /etc/ansible && \
39 echo '[local]\nlocalhost\n' > /etc/ansible/hosts
40
41
42COPY ansible-playbook-wrapper /usr/local/bin/
43
44ONBUILD WORKDIR /tmp
45ONBUILD COPY . /tmp
46
47
48
49# default command: display Ansible version
50CMD [ "ansible-playbook", "--version" ]
diff --git a/centos6-onbuild/ansible-playbook-wrapper b/centos6-onbuild/ansible-playbook-wrapper
new file mode 100755
index 0000000..bf137c8
--- /dev/null
+++ b/centos6-onbuild/ansible-playbook-wrapper
@@ -0,0 +1,30 @@
1#!/bin/sh
2#
3# Simple wrapper for executing ansible-playbook with local connection.
4#
5# USAGE:
6# ansible-playbook-wrapper [other ansible-playbook arguments]
7#
8# ENVIRONMENT VARIABLES:
9#
10# - PLAYBOOK: playbook filename; default = "playbook.yml"
11# - INVENTORY: inventory filename; default = "/etc/ansible/hosts"
12#
13
14
15if [ -z "$PLAYBOOK" ]; then
16 PLAYBOOK=playbook.yml
17fi
18
19
20if [ -z "$INVENTORY" ]; then
21 exec ansible-playbook \
22 $PLAYBOOK \
23 --connection=local \
24 "$@"
25else
26 exec ansible-playbook \
27 -i $INVENTORY $PLAYBOOK \
28 --connection=local \
29 "$@"
30fi
diff --git a/centos6/Dockerfile b/centos6/Dockerfile
new file mode 100644
index 0000000..9a11b01
--- /dev/null
+++ b/centos6/Dockerfile
@@ -0,0 +1,43 @@
1# Dockerfile for building Ansible image for CentOS 6, with as few additional software as possible.
2#
3# @see http://docs.ansible.com/intro_installation.html#latest-release-via-yum
4#
5# [NOTE] To fix the "sudo: sorry, you must have a tty to run sudo" issue,
6# we need to patch /etc/sudoers.
7# @see http://unix.stackexchange.com/questions/122616/why-do-i-need-a-tty-to-run-sudo-if-i-can-sudo-without-a-password
8# @see https://bugzilla.redhat.com/show_bug.cgi?id=1020147
9#
10# Version 1.0
11#
12
13
14# pull base image
15FROM centos:centos6
16
17MAINTAINER William Yeh <william.pjyeh@gmail.com>
18
19
20RUN echo "===> Installing EPEL..." && \
21 yum -y install epel-release && \
22 \
23 \
24 echo "===> Installing Ansible..." && \
25 yum -y install ansible sudo && \
26 \
27 \
28 echo "===> Disabling sudo 'requiretty' setting..." && \
29 sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \
30 \
31 \
32 echo "===> Removing unused YUM resources..." && \
33 yum -y remove epel-release && \
34 yum clean all && \
35 \
36 \
37 echo "===> Adding hosts for convenience..." && \
38 mkdir -p /etc/ansible && \
39 echo '[local]\nlocalhost\n' > /etc/ansible/hosts
40
41
42# default command: display Ansible version
43CMD [ "ansible-playbook", "--version" ]