aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorWilliam Yeh <william.pjyeh@gmail.com>2015-12-15 06:38:42 +0800
committerWilliam Yeh <william.pjyeh@gmail.com>2015-12-15 12:00:31 +0800
commit930848e72e00c9f72fd4302e02dd1c7747696363 (patch)
tree776d96738371319b6eee8901eeaac0134eefa4f5
parenta8aa5c011bab589aef558768b5c91004d0c13fd0 (diff)
downloaddocker-ansible-930848e72e00c9f72fd4302e02dd1c7747696363.tar.gz
docker-ansible-930848e72e00c9f72fd4302e02dd1c7747696363.tar.zst
docker-ansible-930848e72e00c9f72fd4302e02dd1c7747696363.zip
Add: building from source tree.
Fix: systemd conflicts with new CentOS7 image; See https://forums.docker.com/t/yum-update-fails-for-centos-7-container/5060 Fix: ca-certificates should be installed in Debian 7 for `git clone` source tree.
-rw-r--r--.travis.yml41
-rw-r--r--README.md25
-rw-r--r--centos7-onbuild/Dockerfile2
-rw-r--r--centos7/Dockerfile2
-rw-r--r--circle.yml41
-rw-r--r--master-centos6-onbuild/Dockerfile88
-rwxr-xr-xmaster-centos6-onbuild/ansible-playbook-wrapper49
-rw-r--r--master-centos6/Dockerfile78
-rw-r--r--master-centos7-onbuild/Dockerfile88
-rwxr-xr-xmaster-centos7-onbuild/ansible-playbook-wrapper49
-rw-r--r--master-centos7/Dockerfile78
-rw-r--r--master-debian7-onbuild/Dockerfile75
-rwxr-xr-xmaster-debian7-onbuild/ansible-playbook-wrapper49
-rw-r--r--master-debian7/Dockerfile61
-rw-r--r--master-debian8-onbuild/Dockerfile75
-rwxr-xr-xmaster-debian8-onbuild/ansible-playbook-wrapper49
-rw-r--r--master-debian8/Dockerfile61
-rw-r--r--master-ubuntu12.04-onbuild/Dockerfile61
-rwxr-xr-xmaster-ubuntu12.04-onbuild/ansible-playbook-wrapper49
-rw-r--r--master-ubuntu12.04/Dockerfile61
-rw-r--r--master-ubuntu14.04-onbuild/Dockerfile75
-rwxr-xr-xmaster-ubuntu14.04-onbuild/ansible-playbook-wrapper49
-rw-r--r--master-ubuntu14.04/Dockerfile60
23 files changed, 1263 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml
index 06a51ce..3ec8589 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,6 +22,20 @@ before_install:
22 - docker build -t ansible_centos6_onbuild centos6-onbuild 22 - docker build -t ansible_centos6_onbuild centos6-onbuild
23 - docker build -t ansible_alpine3_onbuild alpine3-onbuild 23 - docker build -t ansible_alpine3_onbuild alpine3-onbuild
24 24
25 - docker build -t ansible_master_trusty master-ubuntu14.04
26 - docker build -t ansible_master_precise master-ubuntu12.04
27 - docker build -t ansible_master_jessie master-debian8
28 - docker build -t ansible_master_wheezy master-debian7
29 - docker build -t ansible_master_centos7 master-centos7
30 - docker build -t ansible_master_centos6 master-centos6
31
32 - docker build -t ansible_master_trusty_onbuild master-ubuntu14.04-onbuild
33 - docker build -t ansible_master_precise_onbuild master-ubuntu12.04-onbuild
34 - docker build -t ansible_master_jessie_onbuild master-debian8-onbuild
35 - docker build -t ansible_master_wheezy_onbuild master-debian7-onbuild
36 - docker build -t ansible_master_centos7_onbuild master-centos7-onbuild
37 - docker build -t ansible_master_centos6_onbuild master-centos6-onbuild
38
25script: 39script:
26 - docker run -i ansible_trusty > result-ubuntu14.04 40 - docker run -i ansible_trusty > result-ubuntu14.04
27 - docker run -i ansible_precise > result-ubuntu12.04 41 - docker run -i ansible_precise > result-ubuntu12.04
@@ -38,6 +52,20 @@ script:
38 - docker run -i ansible_centos6_onbuild > result-centos6-onbuild 52 - docker run -i ansible_centos6_onbuild > result-centos6-onbuild
39 - docker run -i ansible_alpine3_onbuild > result-alpine3-onbuild 53 - docker run -i ansible_alpine3_onbuild > result-alpine3-onbuild
40 54
55 - docker run -i ansible_master_trusty > result-master-ubuntu14.04
56 - docker run -i ansible_master_precise > result-master-ubuntu12.04
57 - docker run -i ansible_master_jessie > result-master-debian8
58 - docker run -i ansible_master_wheezy > result-master-debian7
59 - docker run -i ansible_master_centos7 > result-master-centos7
60 - docker run -i ansible_master_centos6 > result-master-centos6
61 - docker run -i ansible_master_trusty_onbuild > result-master-ubuntu14.04-onbuild
62 - docker run -i ansible_master_precise_onbuild > result-master-ubuntu12.04-onbuild
63 - docker run -i ansible_master_jessie_onbuild > result-master-debian8-onbuild
64 - docker run -i ansible_master_wheezy_onbuild > result-master-debian7-onbuild
65 - docker run -i ansible_master_centos7_onbuild > result-master-centos7-onbuild
66 - docker run -i ansible_master_centos6_onbuild > result-master-centos6-onbuild
67
68
41 - echo "==> Validating the test results..." 69 - echo "==> Validating the test results..."
42 - sh -c "[ -s result-ubuntu14.04 ]" 70 - sh -c "[ -s result-ubuntu14.04 ]"
43 - sh -c "[ -s result-ubuntu12.04 ]" 71 - sh -c "[ -s result-ubuntu12.04 ]"
@@ -53,3 +81,16 @@ script:
53 - sh -c "[ -s result-centos7-onbuild ]" 81 - sh -c "[ -s result-centos7-onbuild ]"
54 - sh -c "[ -s result-centos6-onbuild ]" 82 - sh -c "[ -s result-centos6-onbuild ]"
55 - sh -c "[ -s result-alpine3-onbuild ]" 83 - sh -c "[ -s result-alpine3-onbuild ]"
84
85 - sh -c "[ -s result-master-ubuntu14.04 ]"
86 - sh -c "[ -s result-master-ubuntu12.04 ]"
87 - sh -c "[ -s result-master-debian8 ]"
88 - sh -c "[ -s result-master-debian7 ]"
89 - sh -c "[ -s result-master-centos7 ]"
90 - sh -c "[ -s result-master-centos6 ]"
91 - sh -c "[ -s result-master-ubuntu14.04-onbuild ]"
92 - sh -c "[ -s result-master-ubuntu12.04-onbuild ]"
93 - sh -c "[ -s result-master-debian8-onbuild ]"
94 - sh -c "[ -s result-master-debian7-onbuild ]"
95 - sh -c "[ -s result-master-centos7-onbuild ]"
96 - sh -c "[ -s result-master-centos6-onbuild ]"
diff --git a/README.md b/README.md
index ee39d18..34febff 100644
--- a/README.md
+++ b/README.md
@@ -18,11 +18,13 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa
18 18
19- OS: Debian (jessie, wheezy), Ubuntu (trusty, precise), CentOS (7, 6), Alpine (3). 19- OS: Debian (jessie, wheezy), Ubuntu (trusty, precise), CentOS (7, 6), Alpine (3).
20 20
21- Ansible: usually the latest version (I didn't pin any specific version). 21- Ansible: usually the most recent *stable* and *experimental* versions (I didn't pin any specific version).
22 22
23 23
24## Images and tags 24## Images and tags
25 25
26### Stable series (installed from official PyPI repo):
27
26- Normal series: 28- Normal series:
27 29
28 - `williamyeh/ansible:debian8` 30 - `williamyeh/ansible:debian8`
@@ -43,6 +45,27 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa
43 - `williamyeh/ansible:centos6-onbuild` 45 - `williamyeh/ansible:centos6-onbuild`
44 - `williamyeh/ansible:alpine3-onbuild` 46 - `williamyeh/ansible:alpine3-onbuild`
45 47
48### Experimental series (building from the git `master` source tree):
49
50- Normal series:
51
52 - `williamyeh/ansible:master-debian8`
53 - `williamyeh/ansible:master-debian7`
54 - `williamyeh/ansible:master-ubuntu14.04`
55 - `williamyeh/ansible:master-ubuntu12.04`
56 - `williamyeh/ansible:master-centos7`
57 - `williamyeh/ansible:master-centos6`
58
59- Onbuild series (*recommended for common cases*):
60
61 - `williamyeh/ansible:master-debian8-onbuild`
62 - `williamyeh/ansible:master-debian7-onbuild`
63 - `williamyeh/ansible:master-ubuntu14.04-onbuild`
64 - `williamyeh/ansible:master-ubuntu12.04-onbuild`
65 - `williamyeh/ansible:master-centos7-onbuild`
66 - `williamyeh/ansible:master-centos6-onbuild`
67
68
46 69
47## For the impatient 70## For the impatient
48 71
diff --git a/centos7-onbuild/Dockerfile b/centos7-onbuild/Dockerfile
index 6862eb9..8d9bea8 100644
--- a/centos7-onbuild/Dockerfile
+++ b/centos7-onbuild/Dockerfile
@@ -22,7 +22,7 @@ RUN echo "===> Installing EPEL..." && \
22 \ 22 \
23 \ 23 \
24 echo "===> Installing initscripts to emulate normal OS behavior..." && \ 24 echo "===> Installing initscripts to emulate normal OS behavior..." && \
25 yum -y install initscripts && \ 25 yum -y install initscripts systemd-container-EOL && \
26 \ 26 \
27 \ 27 \
28 echo "===> Installing Ansible..." && \ 28 echo "===> Installing Ansible..." && \
diff --git a/centos7/Dockerfile b/centos7/Dockerfile
index c12c301..238b50f 100644
--- a/centos7/Dockerfile
+++ b/centos7/Dockerfile
@@ -22,7 +22,7 @@ RUN echo "===> Installing EPEL..." && \
22 \ 22 \
23 \ 23 \
24 echo "===> Installing initscripts to emulate normal OS behavior..." && \ 24 echo "===> Installing initscripts to emulate normal OS behavior..." && \
25 yum -y install initscripts && \ 25 yum -y install initscripts systemd-container-EOL && \
26 \ 26 \
27 \ 27 \
28 echo "===> Installing Ansible..." && \ 28 echo "===> Installing Ansible..." && \
diff --git a/circle.yml b/circle.yml
index c979c1f..71c1817 100644
--- a/circle.yml
+++ b/circle.yml
@@ -23,6 +23,20 @@ dependencies:
23 - docker build -t ansible_centos6_onbuild centos6-onbuild 23 - docker build -t ansible_centos6_onbuild centos6-onbuild
24 - docker build -t ansible_alpine3_onbuild alpine3-onbuild 24 - docker build -t ansible_alpine3_onbuild alpine3-onbuild
25 25
26 - docker build -t ansible_master_trusty master-ubuntu14.04
27 - docker build -t ansible_master_precise master-ubuntu12.04
28 - docker build -t ansible_master_jessie master-debian8
29 - docker build -t ansible_master_wheezy master-debian7
30 - docker build -t ansible_master_centos7 master-centos7
31 - docker build -t ansible_master_centos6 master-centos6
32
33 - docker build -t ansible_master_trusty_onbuild master-ubuntu14.04-onbuild
34 - docker build -t ansible_master_precise_onbuild master-ubuntu12.04-onbuild
35 - docker build -t ansible_master_jessie_onbuild master-debian8-onbuild
36 - docker build -t ansible_master_wheezy_onbuild master-debian7-onbuild
37 - docker build -t ansible_master_centos7_onbuild master-centos7-onbuild
38 - docker build -t ansible_master_centos6_onbuild master-centos6-onbuild
39
26test: 40test:
27 override: 41 override:
28 - docker run -i ansible_trusty > result-ubuntu14.04 42 - docker run -i ansible_trusty > result-ubuntu14.04
@@ -40,6 +54,20 @@ test:
40 - docker run -i ansible_centos6_onbuild > result-centos6-onbuild 54 - docker run -i ansible_centos6_onbuild > result-centos6-onbuild
41 - docker run -i ansible_alpine3_onbuild > result-alpine3-onbuild 55 - docker run -i ansible_alpine3_onbuild > result-alpine3-onbuild
42 56
57 - docker run -i ansible_master_trusty > result-master-ubuntu14.04
58 - docker run -i ansible_master_precise > result-master-ubuntu12.04
59 - docker run -i ansible_master_jessie > result-master-debian8
60 - docker run -i ansible_master_wheezy > result-master-debian7
61 - docker run -i ansible_master_centos7 > result-master-centos7
62 - docker run -i ansible_master_centos6 > result-master-centos6
63 - docker run -i ansible_master_trusty_onbuild > result-master-ubuntu14.04-onbuild
64 - docker run -i ansible_master_precise_onbuild > result-master-ubuntu12.04-onbuild
65 - docker run -i ansible_master_jessie_onbuild > result-master-debian8-onbuild
66 - docker run -i ansible_master_wheezy_onbuild > result-master-debian7-onbuild
67 - docker run -i ansible_master_centos7_onbuild > result-master-centos7-onbuild
68 - docker run -i ansible_master_centos6_onbuild > result-master-centos6-onbuild
69
70
43 - echo "==> Validating the test results..." 71 - echo "==> Validating the test results..."
44 - sh -c "[ -s result-ubuntu14.04 ]" 72 - sh -c "[ -s result-ubuntu14.04 ]"
45 - sh -c "[ -s result-ubuntu12.04 ]" 73 - sh -c "[ -s result-ubuntu12.04 ]"
@@ -55,3 +83,16 @@ test:
55 - sh -c "[ -s result-centos7-onbuild ]" 83 - sh -c "[ -s result-centos7-onbuild ]"
56 - sh -c "[ -s result-centos6-onbuild ]" 84 - sh -c "[ -s result-centos6-onbuild ]"
57 - sh -c "[ -s result-alpine3-onbuild ]" 85 - sh -c "[ -s result-alpine3-onbuild ]"
86
87 - sh -c "[ -s result-master-ubuntu14.04 ]"
88 - sh -c "[ -s result-master-ubuntu12.04 ]"
89 - sh -c "[ -s result-master-debian8 ]"
90 - sh -c "[ -s result-master-debian7 ]"
91 - sh -c "[ -s result-master-centos7 ]"
92 - sh -c "[ -s result-master-centos6 ]"
93 - sh -c "[ -s result-master-ubuntu14.04-onbuild ]"
94 - sh -c "[ -s result-master-ubuntu12.04-onbuild ]"
95 - sh -c "[ -s result-master-debian8-onbuild ]"
96 - sh -c "[ -s result-master-debian7-onbuild ]"
97 - sh -c "[ -s result-master-centos7-onbuild ]"
98 - sh -c "[ -s result-master-centos6-onbuild ]"
diff --git a/master-centos6-onbuild/Dockerfile b/master-centos6-onbuild/Dockerfile
new file mode 100644
index 0000000..9b21459
--- /dev/null
+++ b/master-centos6-onbuild/Dockerfile
@@ -0,0 +1,88 @@
1# Dockerfile for building Ansible image from source for CentOS 6, with as few additional software as possible.
2#
3# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
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 yum -y update && \
23 \
24 \
25 echo "===> Installing initscripts to emulate normal OS behavior..." && \
26 yum -y install initscripts && \
27 \
28 \
29 echo "===> Adding Ansible's prerequisites..." && \
30 yum -y install \
31 gcc make \
32 python python-devel python-pip \
33 libxml2 libxml2-devel libxslt libxslt-devel \
34 git sudo curl && \
35 pip install --upgrade pip && \
36 pip install --upgrade \
37 pyyaml jinja2 pycrypto paramiko httplib2 && \
38 \
39 \
40 echo "===> Downloading Ansible's source tree..." && \
41 git clone git://github.com/ansible/ansible.git --recursive && \
42 \
43 \
44 echo "===> Compiling Ansible..." && \
45 cd ansible && \
46 bash -c 'source ./hacking/env-setup' && \
47 \
48 \
49 echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \
50 mkdir -p /opt/ansible && \
51 mv /ansible/bin /opt/ansible/bin && \
52 mv /ansible/lib /opt/ansible/lib && \
53 mv /ansible/docs /opt/ansible/docs && \
54 rm -rf /ansible && \
55 \
56 \
57 echo "===> Disabling sudo 'requiretty' setting..." && \
58 sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \
59 \
60 \
61 echo "===> Removing unused YUM resources..." && \
62 yum -y remove \
63 epel-release python-devel python-pip gcc git && \
64 yum clean all && \
65 \
66 \
67 echo "===> Adding hosts for convenience..." && \
68 mkdir -p /etc/ansible && \
69 echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts
70
71
72ENV PATH /opt/ansible/bin:$PATH
73ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH
74ENV MANPATH /opt/ansible/docs/man:$MANPATH
75
76
77COPY ansible-playbook-wrapper /usr/local/bin/
78
79ONBUILD WORKDIR /tmp
80ONBUILD COPY . /tmp
81ONBUILD RUN \
82 echo "===> Diagnosis: host information..." && \
83 ansible -c local -m setup all
84
85
86
87# default command: display Ansible version
88CMD [ "ansible-playbook", "--version" ]
diff --git a/master-centos6-onbuild/ansible-playbook-wrapper b/master-centos6-onbuild/ansible-playbook-wrapper
new file mode 100755
index 0000000..0ba45e6
--- /dev/null
+++ b/master-centos6-onbuild/ansible-playbook-wrapper
@@ -0,0 +1,49 @@
1#!/bin/sh
2#
3# Simple wrapper for executing ansible-galaxy and ansible-playbook
4# with local connection.
5#
6# USAGE:
7# ansible-playbook-wrapper [other ansible-playbook arguments]
8#
9# ENVIRONMENT VARIABLES:
10#
11# - REQUIREMENTS: requirements filename; default = "requirements.yml"
12# - PLAYBOOK: playbook filename; default = "playbook.yml"
13# - INVENTORY: inventory filename; default = "/etc/ansible/hosts"
14#
15
16
17#
18# install Galaxy roles, if any
19#
20
21if [ -z "$REQUIREMENTS" ]; then
22 REQUIREMENTS=requirements.yml
23fi
24
25if [ -f "$REQUIREMENTS" ]; then
26 ansible-galaxy install -r $REQUIREMENTS
27fi
28
29
30#
31# execute playbook
32#
33
34if [ -z "$PLAYBOOK" ]; then
35 PLAYBOOK=playbook.yml
36fi
37
38
39if [ -z "$INVENTORY" ]; then
40 exec ansible-playbook \
41 $PLAYBOOK \
42 --connection=local \
43 "$@"
44else
45 exec ansible-playbook \
46 -i $INVENTORY $PLAYBOOK \
47 --connection=local \
48 "$@"
49fi
diff --git a/master-centos6/Dockerfile b/master-centos6/Dockerfile
new file mode 100644
index 0000000..61c2c15
--- /dev/null
+++ b/master-centos6/Dockerfile
@@ -0,0 +1,78 @@
1# Dockerfile for building Ansible image from source for CentOS 6, with as few additional software as possible.
2#
3# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
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 yum -y update && \
23 \
24 \
25 echo "===> Installing initscripts to emulate normal OS behavior..." && \
26 yum -y install initscripts && \
27 \
28 \
29 echo "===> Adding Ansible's prerequisites..." && \
30 yum -y install \
31 gcc make \
32 python python-devel python-pip \
33 libxml2 libxml2-devel libxslt libxslt-devel \
34 git sudo curl && \
35 pip install --upgrade pip && \
36 pip install --upgrade \
37 pyyaml jinja2 pycrypto paramiko httplib2 && \
38 \
39 \
40 echo "===> Downloading Ansible's source tree..." && \
41 git clone git://github.com/ansible/ansible.git --recursive && \
42 \
43 \
44 echo "===> Compiling Ansible..." && \
45 cd ansible && \
46 bash -c 'source ./hacking/env-setup' && \
47 \
48 \
49 echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \
50 mkdir -p /opt/ansible && \
51 mv /ansible/bin /opt/ansible/bin && \
52 mv /ansible/lib /opt/ansible/lib && \
53 mv /ansible/docs /opt/ansible/docs && \
54 rm -rf /ansible && \
55 \
56 \
57 echo "===> Disabling sudo 'requiretty' setting..." && \
58 sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \
59 \
60 \
61 echo "===> Removing unused YUM resources..." && \
62 yum -y remove \
63 epel-release python-devel python-pip gcc git && \
64 yum clean all && \
65 \
66 \
67 echo "===> Adding hosts for convenience..." && \
68 mkdir -p /etc/ansible && \
69 echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts
70
71
72ENV PATH /opt/ansible/bin:$PATH
73ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH
74ENV MANPATH /opt/ansible/docs/man:$MANPATH
75
76
77# default command: display Ansible version
78CMD [ "ansible-playbook", "--version" ]
diff --git a/master-centos7-onbuild/Dockerfile b/master-centos7-onbuild/Dockerfile
new file mode 100644
index 0000000..feb87fe
--- /dev/null
+++ b/master-centos7-onbuild/Dockerfile
@@ -0,0 +1,88 @@
1# Dockerfile for building Ansible image from source for CentOS 7, with as few additional software as possible.
2#
3# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
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:centos7
16
17MAINTAINER William Yeh <william.pjyeh@gmail.com>
18
19
20RUN echo "===> Installing EPEL..." && \
21 yum -y install epel-release && \
22 yum -y update && \
23 \
24 \
25 echo "===> Installing initscripts to emulate normal OS behavior..." && \
26 yum -y install initscripts systemd-container-EOL && \
27 \
28 \
29 echo "===> Adding Ansible's prerequisites..." && \
30 yum -y install \
31 gcc make \
32 python python-devel python-pip \
33 libxml2 libxml2-devel libxslt libxslt-devel \
34 git sudo curl && \
35 pip install --upgrade pip && \
36 pip install --upgrade \
37 pyyaml jinja2 pycrypto paramiko httplib2 && \
38 \
39 \
40 echo "===> Downloading Ansible's source tree..." && \
41 git clone git://github.com/ansible/ansible.git --recursive && \
42 \
43 \
44 echo "===> Compiling Ansible..." && \
45 cd ansible && \
46 bash -c 'source ./hacking/env-setup' && \
47 \
48 \
49 echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \
50 mkdir -p /opt/ansible && \
51 mv /ansible/bin /opt/ansible/bin && \
52 mv /ansible/lib /opt/ansible/lib && \
53 mv /ansible/docs /opt/ansible/docs && \
54 rm -rf /ansible && \
55 \
56 \
57 echo "===> Disabling sudo 'requiretty' setting..." && \
58 sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \
59 \
60 \
61 echo "===> Removing unused YUM resources..." && \
62 yum -y remove \
63 epel-release python-devel python-pip gcc git && \
64 yum clean all && \
65 \
66 \
67 echo "===> Adding hosts for convenience..." && \
68 mkdir -p /etc/ansible && \
69 echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts
70
71
72ENV PATH /opt/ansible/bin:$PATH
73ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH
74ENV MANPATH /opt/ansible/docs/man:$MANPATH
75
76
77COPY ansible-playbook-wrapper /usr/local/bin/
78
79ONBUILD WORKDIR /tmp
80ONBUILD COPY . /tmp
81ONBUILD RUN \
82 echo "===> Diagnosis: host information..." && \
83 ansible -c local -m setup all
84
85
86
87# default command: display Ansible version
88CMD [ "ansible-playbook", "--version" ]
diff --git a/master-centos7-onbuild/ansible-playbook-wrapper b/master-centos7-onbuild/ansible-playbook-wrapper
new file mode 100755
index 0000000..0ba45e6
--- /dev/null
+++ b/master-centos7-onbuild/ansible-playbook-wrapper
@@ -0,0 +1,49 @@
1#!/bin/sh
2#
3# Simple wrapper for executing ansible-galaxy and ansible-playbook
4# with local connection.
5#
6# USAGE:
7# ansible-playbook-wrapper [other ansible-playbook arguments]
8#
9# ENVIRONMENT VARIABLES:
10#
11# - REQUIREMENTS: requirements filename; default = "requirements.yml"
12# - PLAYBOOK: playbook filename; default = "playbook.yml"
13# - INVENTORY: inventory filename; default = "/etc/ansible/hosts"
14#
15
16
17#
18# install Galaxy roles, if any
19#
20
21if [ -z "$REQUIREMENTS" ]; then
22 REQUIREMENTS=requirements.yml
23fi
24
25if [ -f "$REQUIREMENTS" ]; then
26 ansible-galaxy install -r $REQUIREMENTS
27fi
28
29
30#
31# execute playbook
32#
33
34if [ -z "$PLAYBOOK" ]; then
35 PLAYBOOK=playbook.yml
36fi
37
38
39if [ -z "$INVENTORY" ]; then
40 exec ansible-playbook \
41 $PLAYBOOK \
42 --connection=local \
43 "$@"
44else
45 exec ansible-playbook \
46 -i $INVENTORY $PLAYBOOK \
47 --connection=local \
48 "$@"
49fi
diff --git a/master-centos7/Dockerfile b/master-centos7/Dockerfile
new file mode 100644
index 0000000..a50171d
--- /dev/null
+++ b/master-centos7/Dockerfile
@@ -0,0 +1,78 @@
1# Dockerfile for building Ansible image from source for CentOS 7, with as few additional software as possible.
2#
3# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
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:centos7
16
17MAINTAINER William Yeh <william.pjyeh@gmail.com>
18
19
20RUN echo "===> Installing EPEL..." && \
21 yum -y install epel-release && \
22 yum -y update && \
23 \
24 \
25 echo "===> Installing initscripts to emulate normal OS behavior..." && \
26 yum -y install initscripts systemd-container-EOL && \
27 \
28 \
29 echo "===> Adding Ansible's prerequisites..." && \
30 yum -y install \
31 gcc make \
32 python python-devel python-pip \
33 libxml2 libxml2-devel libxslt libxslt-devel \
34 git sudo curl && \
35 pip install --upgrade pip && \
36 pip install --upgrade \
37 pyyaml jinja2 pycrypto paramiko httplib2 && \
38 \
39 \
40 echo "===> Downloading Ansible's source tree..." && \
41 git clone git://github.com/ansible/ansible.git --recursive && \
42 \
43 \
44 echo "===> Compiling Ansible..." && \
45 cd ansible && \
46 bash -c 'source ./hacking/env-setup' && \
47 \
48 \
49 echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \
50 mkdir -p /opt/ansible && \
51 mv /ansible/bin /opt/ansible/bin && \
52 mv /ansible/lib /opt/ansible/lib && \
53 mv /ansible/docs /opt/ansible/docs && \
54 rm -rf /ansible && \
55 \
56 \
57 echo "===> Disabling sudo 'requiretty' setting..." && \
58 sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \
59 \
60 \
61 echo "===> Removing unused YUM resources..." && \
62 yum -y remove \
63 epel-release python-devel python-pip gcc git && \
64 yum clean all && \
65 \
66 \
67 echo "===> Adding hosts for convenience..." && \
68 mkdir -p /etc/ansible && \
69 echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts
70
71
72ENV PATH /opt/ansible/bin:$PATH
73ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH
74ENV MANPATH /opt/ansible/docs/man:$MANPATH
75
76
77# default command: display Ansible version
78CMD [ "ansible-playbook", "--version" ]
diff --git a/master-debian7-onbuild/Dockerfile b/master-debian7-onbuild/Dockerfile
new file mode 100644
index 0000000..958e926
--- /dev/null
+++ b/master-debian7-onbuild/Dockerfile
@@ -0,0 +1,75 @@
1# Dockerfile for building Ansible image from source for Debian 7 (wheezy), with as few additional software as possible.
2#
3# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
4#
5# Version 1.0
6#
7
8
9# pull base image
10FROM debian:wheezy
11
12MAINTAINER William Yeh <william.pjyeh@gmail.com>
13
14
15RUN echo "===> Adding Ansible's prerequisites..." && \
16 apt-get update -y && \
17 DEBIAN_FRONTEND=noninteractive \
18 apt-get install --no-install-recommends -y -q \
19 build-essential ca-certificates \
20 python-pip python-dev python-yaml \
21 libxml2-dev libxslt1-dev zlib1g-dev \
22 git sudo curl && \
23 pip install --upgrade pyyaml jinja2 pycrypto && \
24 \
25 \
26 echo "===> Downloading Ansible's source tree..." && \
27 git clone git://github.com/ansible/ansible.git --recursive && \
28 \
29 \
30 echo "===> Compiling Ansible..." && \
31 cd ansible && \
32 bash -c 'source ./hacking/env-setup' && \
33 \
34 \
35 echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \
36 mkdir -p /opt/ansible && \
37 mv /ansible/bin /opt/ansible/bin && \
38 mv /ansible/lib /opt/ansible/lib && \
39 mv /ansible/docs /opt/ansible/docs && \
40 rm -rf /ansible && \
41 \
42 \
43 echo "===> Clean up..." && \
44 apt-get remove -y --auto-remove \
45 build-essential python-pip python-dev git && \
46 apt-get clean && \
47 rm -rf /var/lib/apt/lists/* && \
48 \
49 \
50 echo "===> Adding hosts for convenience..." && \
51 mkdir -p /etc/ansible && \
52 echo '[local]\nlocalhost\n' > /etc/ansible/hosts
53
54
55ENV PATH /opt/ansible/bin:$PATH
56ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH
57ENV MANPATH /opt/ansible/docs/man:$MANPATH
58
59
60COPY ansible-playbook-wrapper /usr/local/bin/
61
62ONBUILD RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
63 echo "===> Updating TLS certificates..." && \
64 apt-get install -y openssl ca-certificates
65
66ONBUILD WORKDIR /tmp
67ONBUILD COPY . /tmp
68ONBUILD RUN \
69 echo "===> Diagnosis: host information..." && \
70 ansible -c local -m setup all
71
72
73
74# default command: display Ansible version
75CMD [ "ansible-playbook", "--version" ]
diff --git a/master-debian7-onbuild/ansible-playbook-wrapper b/master-debian7-onbuild/ansible-playbook-wrapper
new file mode 100755
index 0000000..0ba45e6
--- /dev/null
+++ b/master-debian7-onbuild/ansible-playbook-wrapper
@@ -0,0 +1,49 @@
1#!/bin/sh
2#
3# Simple wrapper for executing ansible-galaxy and ansible-playbook
4# with local connection.
5#
6# USAGE:
7# ansible-playbook-wrapper [other ansible-playbook arguments]
8#
9# ENVIRONMENT VARIABLES:
10#
11# - REQUIREMENTS: requirements filename; default = "requirements.yml"
12# - PLAYBOOK: playbook filename; default = "playbook.yml"
13# - INVENTORY: inventory filename; default = "/etc/ansible/hosts"
14#
15
16
17#
18# install Galaxy roles, if any
19#
20
21if [ -z "$REQUIREMENTS" ]; then
22 REQUIREMENTS=requirements.yml
23fi
24
25if [ -f "$REQUIREMENTS" ]; then
26 ansible-galaxy install -r $REQUIREMENTS
27fi
28
29
30#
31# execute playbook
32#
33
34if [ -z "$PLAYBOOK" ]; then
35 PLAYBOOK=playbook.yml
36fi
37
38
39if [ -z "$INVENTORY" ]; then
40 exec ansible-playbook \
41 $PLAYBOOK \
42 --connection=local \
43 "$@"
44else
45 exec ansible-playbook \
46 -i $INVENTORY $PLAYBOOK \
47 --connection=local \
48 "$@"
49fi
diff --git a/master-debian7/Dockerfile b/master-debian7/Dockerfile
new file mode 100644
index 0000000..0a32f5c
--- /dev/null
+++ b/master-debian7/Dockerfile
@@ -0,0 +1,61 @@
1# Dockerfile for building Ansible image from source for Debian 7 (wheezy), with as few additional software as possible.
2#
3# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
4#
5# Version 1.0
6#
7
8
9# pull base image
10FROM debian:wheezy
11
12MAINTAINER William Yeh <william.pjyeh@gmail.com>
13
14
15RUN echo "===> Adding Ansible's prerequisites..." && \
16 apt-get update -y && \
17 DEBIAN_FRONTEND=noninteractive \
18 apt-get install --no-install-recommends -y -q \
19 build-essential ca-certificates \
20 python-pip python-dev python-yaml \
21 libxml2-dev libxslt1-dev zlib1g-dev \
22 git sudo curl && \
23 pip install --upgrade pyyaml jinja2 pycrypto && \
24 \
25 \
26 echo "===> Downloading Ansible's source tree..." && \
27 git clone git://github.com/ansible/ansible.git --recursive && \
28 \
29 \
30 echo "===> Compiling Ansible..." && \
31 cd ansible && \
32 bash -c 'source ./hacking/env-setup' && \
33 \
34 \
35 echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \
36 mkdir -p /opt/ansible && \
37 mv /ansible/bin /opt/ansible/bin && \
38 mv /ansible/lib /opt/ansible/lib && \
39 mv /ansible/docs /opt/ansible/docs && \
40 rm -rf /ansible && \
41 \
42 \
43 echo "===> Clean up..." && \
44 apt-get remove -y --auto-remove \
45 build-essential python-pip python-dev git && \
46 apt-get clean && \
47 rm -rf /var/lib/apt/lists/* && \
48 \
49 \
50 echo "===> Adding hosts for convenience..." && \
51 mkdir -p /etc/ansible && \
52 echo '[local]\nlocalhost\n' > /etc/ansible/hosts
53
54
55ENV PATH /opt/ansible/bin:$PATH
56ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH
57ENV MANPATH /opt/ansible/docs/man:$MANPATH
58
59
60# default command: display Ansible version
61CMD [ "ansible-playbook", "--version" ]
diff --git a/master-debian8-onbuild/Dockerfile b/master-debian8-onbuild/Dockerfile
new file mode 100644
index 0000000..d8e8802
--- /dev/null
+++ b/master-debian8-onbuild/Dockerfile
@@ -0,0 +1,75 @@
1# Dockerfile for building Ansible image from source for Debian 8 (jessie), with as few additional software as possible.
2#
3# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
4#
5# Version 1.0
6#
7
8
9# pull base image
10FROM debian:jessie
11
12MAINTAINER William Yeh <william.pjyeh@gmail.com>
13
14
15RUN echo "===> Adding Ansible's prerequisites..." && \
16 apt-get update -y && \
17 DEBIAN_FRONTEND=noninteractive \
18 apt-get install --no-install-recommends -y -q \
19 build-essential ca-certificates \
20 python-pip python-dev python-yaml \
21 libxml2-dev libxslt1-dev zlib1g-dev \
22 git sudo curl && \
23 pip install --upgrade pyyaml jinja2 pycrypto && \
24 \
25 \
26 echo "===> Downloading Ansible's source tree..." && \
27 git clone git://github.com/ansible/ansible.git --recursive && \
28 \
29 \
30 echo "===> Compiling Ansible..." && \
31 cd ansible && \
32 bash -c 'source ./hacking/env-setup' && \
33 \
34 \
35 echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \
36 mkdir -p /opt/ansible && \
37 mv /ansible/bin /opt/ansible/bin && \
38 mv /ansible/lib /opt/ansible/lib && \
39 mv /ansible/docs /opt/ansible/docs && \
40 rm -rf /ansible && \
41 \
42 \
43 echo "===> Clean up..." && \
44 apt-get remove -y --auto-remove \
45 build-essential python-pip python-dev git && \
46 apt-get clean && \
47 rm -rf /var/lib/apt/lists/* && \
48 \
49 \
50 echo "===> Adding hosts for convenience..." && \
51 mkdir -p /etc/ansible && \
52 echo '[local]\nlocalhost\n' > /etc/ansible/hosts
53
54
55ENV PATH /opt/ansible/bin:$PATH
56ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH
57ENV MANPATH /opt/ansible/docs/man:$MANPATH
58
59
60COPY ansible-playbook-wrapper /usr/local/bin/
61
62ONBUILD RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
63 echo "===> Updating TLS certificates..." && \
64 apt-get install -y openssl ca-certificates
65
66ONBUILD WORKDIR /tmp
67ONBUILD COPY . /tmp
68ONBUILD RUN \
69 echo "===> Diagnosis: host information..." && \
70 ansible -c local -m setup all
71
72
73
74# default command: display Ansible version
75CMD [ "ansible-playbook", "--version" ]
diff --git a/master-debian8-onbuild/ansible-playbook-wrapper b/master-debian8-onbuild/ansible-playbook-wrapper
new file mode 100755
index 0000000..0ba45e6
--- /dev/null
+++ b/master-debian8-onbuild/ansible-playbook-wrapper
@@ -0,0 +1,49 @@
1#!/bin/sh
2#
3# Simple wrapper for executing ansible-galaxy and ansible-playbook
4# with local connection.
5#
6# USAGE:
7# ansible-playbook-wrapper [other ansible-playbook arguments]
8#
9# ENVIRONMENT VARIABLES:
10#
11# - REQUIREMENTS: requirements filename; default = "requirements.yml"
12# - PLAYBOOK: playbook filename; default = "playbook.yml"
13# - INVENTORY: inventory filename; default = "/etc/ansible/hosts"
14#
15
16
17#
18# install Galaxy roles, if any
19#
20
21if [ -z "$REQUIREMENTS" ]; then
22 REQUIREMENTS=requirements.yml
23fi
24
25if [ -f "$REQUIREMENTS" ]; then
26 ansible-galaxy install -r $REQUIREMENTS
27fi
28
29
30#
31# execute playbook
32#
33
34if [ -z "$PLAYBOOK" ]; then
35 PLAYBOOK=playbook.yml
36fi
37
38
39if [ -z "$INVENTORY" ]; then
40 exec ansible-playbook \
41 $PLAYBOOK \
42 --connection=local \
43 "$@"
44else
45 exec ansible-playbook \
46 -i $INVENTORY $PLAYBOOK \
47 --connection=local \
48 "$@"
49fi
diff --git a/master-debian8/Dockerfile b/master-debian8/Dockerfile
new file mode 100644
index 0000000..80c28f0
--- /dev/null
+++ b/master-debian8/Dockerfile
@@ -0,0 +1,61 @@
1# Dockerfile for building Ansible image from source for Debian 8 (jessie), with as few additional software as possible.
2#
3# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
4#
5# Version 1.0
6#
7
8
9# pull base image
10FROM debian:jessie
11
12MAINTAINER William Yeh <william.pjyeh@gmail.com>
13
14
15RUN echo "===> Adding Ansible's prerequisites..." && \
16 apt-get update -y && \
17 DEBIAN_FRONTEND=noninteractive \
18 apt-get install --no-install-recommends -y -q \
19 build-essential ca-certificates \
20 python-pip python-dev python-yaml \
21 libxml2-dev libxslt1-dev zlib1g-dev \
22 git sudo curl && \
23 pip install --upgrade pyyaml jinja2 pycrypto && \
24 \
25 \
26 echo "===> Downloading Ansible's source tree..." && \
27 git clone git://github.com/ansible/ansible.git --recursive && \
28 \
29 \
30 echo "===> Compiling Ansible..." && \
31 cd ansible && \
32 bash -c 'source ./hacking/env-setup' && \
33 \
34 \
35 echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \
36 mkdir -p /opt/ansible && \
37 mv /ansible/bin /opt/ansible/bin && \
38 mv /ansible/lib /opt/ansible/lib && \
39 mv /ansible/docs /opt/ansible/docs && \
40 rm -rf /ansible && \
41 \
42 \
43 echo "===> Clean up..." && \
44 apt-get remove -y --auto-remove \
45 build-essential python-pip python-dev git && \
46 apt-get clean && \
47 rm -rf /var/lib/apt/lists/* && \
48 \
49 \
50 echo "===> Adding hosts for convenience..." && \
51 mkdir -p /etc/ansible && \
52 echo '[local]\nlocalhost\n' > /etc/ansible/hosts
53
54
55ENV PATH /opt/ansible/bin:$PATH
56ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH
57ENV MANPATH /opt/ansible/docs/man:$MANPATH
58
59
60# default command: display Ansible version
61CMD [ "ansible-playbook", "--version" ]
diff --git a/master-ubuntu12.04-onbuild/Dockerfile b/master-ubuntu12.04-onbuild/Dockerfile
new file mode 100644
index 0000000..6206dd2
--- /dev/null
+++ b/master-ubuntu12.04-onbuild/Dockerfile
@@ -0,0 +1,61 @@
1# Dockerfile for building Ansible image from source for Ubuntu 12.04 (presice), with as few additional software as possible.
2#
3# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
4#
5# Version 1.0
6#
7
8
9# pull base image
10FROM ubuntu:12.04
11
12MAINTAINER William Yeh <william.pjyeh@gmail.com>
13
14
15RUN echo "===> Adding Ansible's prerequisites..." && \
16 apt-get update -y && \
17 DEBIAN_FRONTEND=noninteractive \
18 apt-get install --no-install-recommends -y -q \
19 build-essential \
20 python-pip python-dev python-yaml \
21 libxml2-dev libxslt1-dev zlib1g-dev \
22 git sudo && \
23 pip install --upgrade pyyaml jinja2 pycrypto && \
24 \
25 \
26 echo "===> Downloading Ansible's source tree..." && \
27 git clone git://github.com/ansible/ansible.git --recursive && \
28 \
29 \
30 echo "===> Compiling Ansible..." && \
31 cd ansible && \
32 bash -c 'source ./hacking/env-setup' && \
33 \
34 \
35 echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \
36 mkdir -p /opt/ansible && \
37 mv /ansible/bin /opt/ansible/bin && \
38 mv /ansible/lib /opt/ansible/lib && \
39 mv /ansible/docs /opt/ansible/docs && \
40 rm -rf /ansible && \
41 \
42 \
43 echo "===> Clean up..." && \
44 apt-get remove -y --auto-remove \
45 build-essential python-pip python-dev git && \
46 apt-get clean && \
47 rm -rf /var/lib/apt/lists/* && \
48 \
49 \
50 echo "===> Adding hosts for convenience..." && \
51 mkdir -p /etc/ansible && \
52 echo '[local]\nlocalhost\n' > /etc/ansible/hosts
53
54
55ENV PATH /opt/ansible/bin:$PATH
56ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH
57ENV MANPATH /opt/ansible/docs/man:$MANPATH
58
59
60# default command: display Ansible version
61CMD [ "ansible-playbook", "--version" ]
diff --git a/master-ubuntu12.04-onbuild/ansible-playbook-wrapper b/master-ubuntu12.04-onbuild/ansible-playbook-wrapper
new file mode 100755
index 0000000..0ba45e6
--- /dev/null
+++ b/master-ubuntu12.04-onbuild/ansible-playbook-wrapper
@@ -0,0 +1,49 @@
1#!/bin/sh
2#
3# Simple wrapper for executing ansible-galaxy and ansible-playbook
4# with local connection.
5#
6# USAGE:
7# ansible-playbook-wrapper [other ansible-playbook arguments]
8#
9# ENVIRONMENT VARIABLES:
10#
11# - REQUIREMENTS: requirements filename; default = "requirements.yml"
12# - PLAYBOOK: playbook filename; default = "playbook.yml"
13# - INVENTORY: inventory filename; default = "/etc/ansible/hosts"
14#
15
16
17#
18# install Galaxy roles, if any
19#
20
21if [ -z "$REQUIREMENTS" ]; then
22 REQUIREMENTS=requirements.yml
23fi
24
25if [ -f "$REQUIREMENTS" ]; then
26 ansible-galaxy install -r $REQUIREMENTS
27fi
28
29
30#
31# execute playbook
32#
33
34if [ -z "$PLAYBOOK" ]; then
35 PLAYBOOK=playbook.yml
36fi
37
38
39if [ -z "$INVENTORY" ]; then
40 exec ansible-playbook \
41 $PLAYBOOK \
42 --connection=local \
43 "$@"
44else
45 exec ansible-playbook \
46 -i $INVENTORY $PLAYBOOK \
47 --connection=local \
48 "$@"
49fi
diff --git a/master-ubuntu12.04/Dockerfile b/master-ubuntu12.04/Dockerfile
new file mode 100644
index 0000000..6206dd2
--- /dev/null
+++ b/master-ubuntu12.04/Dockerfile
@@ -0,0 +1,61 @@
1# Dockerfile for building Ansible image from source for Ubuntu 12.04 (presice), with as few additional software as possible.
2#
3# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
4#
5# Version 1.0
6#
7
8
9# pull base image
10FROM ubuntu:12.04
11
12MAINTAINER William Yeh <william.pjyeh@gmail.com>
13
14
15RUN echo "===> Adding Ansible's prerequisites..." && \
16 apt-get update -y && \
17 DEBIAN_FRONTEND=noninteractive \
18 apt-get install --no-install-recommends -y -q \
19 build-essential \
20 python-pip python-dev python-yaml \
21 libxml2-dev libxslt1-dev zlib1g-dev \
22 git sudo && \
23 pip install --upgrade pyyaml jinja2 pycrypto && \
24 \
25 \
26 echo "===> Downloading Ansible's source tree..." && \
27 git clone git://github.com/ansible/ansible.git --recursive && \
28 \
29 \
30 echo "===> Compiling Ansible..." && \
31 cd ansible && \
32 bash -c 'source ./hacking/env-setup' && \
33 \
34 \
35 echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \
36 mkdir -p /opt/ansible && \
37 mv /ansible/bin /opt/ansible/bin && \
38 mv /ansible/lib /opt/ansible/lib && \
39 mv /ansible/docs /opt/ansible/docs && \
40 rm -rf /ansible && \
41 \
42 \
43 echo "===> Clean up..." && \
44 apt-get remove -y --auto-remove \
45 build-essential python-pip python-dev git && \
46 apt-get clean && \
47 rm -rf /var/lib/apt/lists/* && \
48 \
49 \
50 echo "===> Adding hosts for convenience..." && \
51 mkdir -p /etc/ansible && \
52 echo '[local]\nlocalhost\n' > /etc/ansible/hosts
53
54
55ENV PATH /opt/ansible/bin:$PATH
56ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH
57ENV MANPATH /opt/ansible/docs/man:$MANPATH
58
59
60# default command: display Ansible version
61CMD [ "ansible-playbook", "--version" ]
diff --git a/master-ubuntu14.04-onbuild/Dockerfile b/master-ubuntu14.04-onbuild/Dockerfile
new file mode 100644
index 0000000..a27deb5
--- /dev/null
+++ b/master-ubuntu14.04-onbuild/Dockerfile
@@ -0,0 +1,75 @@
1# Dockerfile for building Ansible image from source for Ubuntu 14.04 (trusty), with as few additional software as possible.
2#
3# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
4#
5# Version 1.0
6#
7
8
9# pull base image
10FROM ubuntu:14.04
11
12MAINTAINER William Yeh <william.pjyeh@gmail.com>
13
14
15RUN echo "===> Adding Ansible's prerequisites..." && \
16 apt-get update -y && \
17 DEBIAN_FRONTEND=noninteractive \
18 apt-get install --no-install-recommends -y -q \
19 build-essential \
20 python-pip python-dev python-yaml \
21 libxml2-dev libxslt1-dev zlib1g-dev \
22 git && \
23 pip install --upgrade pyyaml jinja2 pycrypto && \
24 \
25 \
26 echo "===> Downloading Ansible's source tree..." && \
27 git clone git://github.com/ansible/ansible.git --recursive && \
28 \
29 \
30 echo "===> Compiling Ansible..." && \
31 cd ansible && \
32 bash -c 'source ./hacking/env-setup' && \
33 \
34 \
35 echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \
36 mkdir -p /opt/ansible && \
37 mv /ansible/bin /opt/ansible/bin && \
38 mv /ansible/lib /opt/ansible/lib && \
39 mv /ansible/docs /opt/ansible/docs && \
40 rm -rf /ansible && \
41 \
42 \
43 echo "===> Clean up..." && \
44 apt-get remove -y --auto-remove \
45 build-essential python-pip python-dev git && \
46 apt-get clean && \
47 rm -rf /var/lib/apt/lists/* && \
48 \
49 \
50 echo "===> Adding hosts for convenience..." && \
51 mkdir -p /etc/ansible && \
52 echo '[local]\nlocalhost\n' > /etc/ansible/hosts
53
54
55ENV PATH /opt/ansible/bin:$PATH
56ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH
57ENV MANPATH /opt/ansible/docs/man:$MANPATH
58
59
60COPY ansible-playbook-wrapper /usr/local/bin/
61
62ONBUILD RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
63 echo "===> Updating TLS certificates..." && \
64 apt-get install -y openssl ca-certificates
65
66ONBUILD WORKDIR /tmp
67ONBUILD COPY . /tmp
68ONBUILD RUN \
69 echo "===> Diagnosis: host information..." && \
70 ansible -c local -m setup all
71
72
73
74# default command: display Ansible version
75CMD [ "ansible-playbook", "--version" ]
diff --git a/master-ubuntu14.04-onbuild/ansible-playbook-wrapper b/master-ubuntu14.04-onbuild/ansible-playbook-wrapper
new file mode 100755
index 0000000..0ba45e6
--- /dev/null
+++ b/master-ubuntu14.04-onbuild/ansible-playbook-wrapper
@@ -0,0 +1,49 @@
1#!/bin/sh
2#
3# Simple wrapper for executing ansible-galaxy and ansible-playbook
4# with local connection.
5#
6# USAGE:
7# ansible-playbook-wrapper [other ansible-playbook arguments]
8#
9# ENVIRONMENT VARIABLES:
10#
11# - REQUIREMENTS: requirements filename; default = "requirements.yml"
12# - PLAYBOOK: playbook filename; default = "playbook.yml"
13# - INVENTORY: inventory filename; default = "/etc/ansible/hosts"
14#
15
16
17#
18# install Galaxy roles, if any
19#
20
21if [ -z "$REQUIREMENTS" ]; then
22 REQUIREMENTS=requirements.yml
23fi
24
25if [ -f "$REQUIREMENTS" ]; then
26 ansible-galaxy install -r $REQUIREMENTS
27fi
28
29
30#
31# execute playbook
32#
33
34if [ -z "$PLAYBOOK" ]; then
35 PLAYBOOK=playbook.yml
36fi
37
38
39if [ -z "$INVENTORY" ]; then
40 exec ansible-playbook \
41 $PLAYBOOK \
42 --connection=local \
43 "$@"
44else
45 exec ansible-playbook \
46 -i $INVENTORY $PLAYBOOK \
47 --connection=local \
48 "$@"
49fi
diff --git a/master-ubuntu14.04/Dockerfile b/master-ubuntu14.04/Dockerfile
new file mode 100644
index 0000000..648a313
--- /dev/null
+++ b/master-ubuntu14.04/Dockerfile
@@ -0,0 +1,60 @@
1# Dockerfile for building Ansible image from source for Ubuntu 14.04 (trusty), with as few additional software as possible.
2#
3# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
4#
5# Version 1.0
6#
7
8
9# pull base image
10FROM ubuntu:14.04
11
12MAINTAINER William Yeh <william.pjyeh@gmail.com>
13
14
15RUN echo "===> Adding Ansible's prerequisites..." && \
16 apt-get update -y && \
17 DEBIAN_FRONTEND=noninteractive \
18 apt-get install --no-install-recommends -y -q \
19 build-essential \
20 python-pip python-dev python-yaml \
21 libxml2-dev libxslt1-dev zlib1g-dev \
22 git && \
23 pip install --upgrade pyyaml jinja2 pycrypto && \
24 \
25 \
26 echo "===> Downloading Ansible's source tree..." && \
27 git clone git://github.com/ansible/ansible.git --recursive && \
28 \
29 \
30 echo "===> Compiling Ansible..." && \
31 cd ansible && \
32 bash -c 'source ./hacking/env-setup' && \
33 \
34 \
35 echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \
36 mkdir -p /opt/ansible && \
37 mv /ansible/bin /opt/ansible/bin && \
38 mv /ansible/lib /opt/ansible/lib && \
39 mv /ansible/docs /opt/ansible/docs && \
40 rm -rf /ansible && \
41 \
42 \
43 echo "===> Clean up..." && \
44 apt-get remove -y --auto-remove \
45 build-essential python-pip python-dev git && \
46 apt-get clean && \
47 rm -rf /var/lib/apt/lists/* && \
48 \
49 \
50 echo "===> Adding hosts for convenience..." && \
51 mkdir -p /etc/ansible && \
52 echo '[local]\nlocalhost\n' > /etc/ansible/hosts
53
54
55ENV PATH /opt/ansible/bin:$PATH
56ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH
57ENV MANPATH /opt/ansible/docs/man:$MANPATH
58
59# default command: display Ansible version
60CMD [ "ansible-playbook", "--version" ]