]> git.immae.eu Git - github/fretlink/docker-ansible.git/commitdiff
Add: building from source tree.
authorWilliam Yeh <william.pjyeh@gmail.com>
Mon, 14 Dec 2015 22:38:42 +0000 (06:38 +0800)
committerWilliam Yeh <william.pjyeh@gmail.com>
Tue, 15 Dec 2015 04:00:31 +0000 (12:00 +0800)
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.

23 files changed:
.travis.yml
README.md
centos7-onbuild/Dockerfile
centos7/Dockerfile
circle.yml
master-centos6-onbuild/Dockerfile [new file with mode: 0644]
master-centos6-onbuild/ansible-playbook-wrapper [new file with mode: 0755]
master-centos6/Dockerfile [new file with mode: 0644]
master-centos7-onbuild/Dockerfile [new file with mode: 0644]
master-centos7-onbuild/ansible-playbook-wrapper [new file with mode: 0755]
master-centos7/Dockerfile [new file with mode: 0644]
master-debian7-onbuild/Dockerfile [new file with mode: 0644]
master-debian7-onbuild/ansible-playbook-wrapper [new file with mode: 0755]
master-debian7/Dockerfile [new file with mode: 0644]
master-debian8-onbuild/Dockerfile [new file with mode: 0644]
master-debian8-onbuild/ansible-playbook-wrapper [new file with mode: 0755]
master-debian8/Dockerfile [new file with mode: 0644]
master-ubuntu12.04-onbuild/Dockerfile [new file with mode: 0644]
master-ubuntu12.04-onbuild/ansible-playbook-wrapper [new file with mode: 0755]
master-ubuntu12.04/Dockerfile [new file with mode: 0644]
master-ubuntu14.04-onbuild/Dockerfile [new file with mode: 0644]
master-ubuntu14.04-onbuild/ansible-playbook-wrapper [new file with mode: 0755]
master-ubuntu14.04/Dockerfile [new file with mode: 0644]

index 06a51cee563aa09b8b4fe315874e33fb60bdcb64..3ec8589db46044d8389f49b6fb86eac40c4c5932 100644 (file)
@@ -22,6 +22,20 @@ before_install:
     - docker build  -t ansible_centos6_onbuild  centos6-onbuild
     - docker build  -t ansible_alpine3_onbuild  alpine3-onbuild
 
+    - docker build  -t ansible_master_trusty           master-ubuntu14.04
+    - docker build  -t ansible_master_precise          master-ubuntu12.04
+    - docker build  -t ansible_master_jessie           master-debian8
+    - docker build  -t ansible_master_wheezy           master-debian7
+    - docker build  -t ansible_master_centos7          master-centos7
+    - docker build  -t ansible_master_centos6          master-centos6
+
+    - docker build  -t ansible_master_trusty_onbuild   master-ubuntu14.04-onbuild
+    - docker build  -t ansible_master_precise_onbuild  master-ubuntu12.04-onbuild
+    - docker build  -t ansible_master_jessie_onbuild   master-debian8-onbuild
+    - docker build  -t ansible_master_wheezy_onbuild   master-debian7-onbuild
+    - docker build  -t ansible_master_centos7_onbuild  master-centos7-onbuild
+    - docker build  -t ansible_master_centos6_onbuild  master-centos6-onbuild
+
 script:
     - docker run -i ansible_trusty           > result-ubuntu14.04
     - docker run -i ansible_precise          > result-ubuntu12.04
@@ -38,6 +52,20 @@ script:
     - docker run -i ansible_centos6_onbuild  > result-centos6-onbuild
     - docker run -i ansible_alpine3_onbuild  > result-alpine3-onbuild
 
+    - docker run -i ansible_master_trusty           > result-master-ubuntu14.04
+    - docker run -i ansible_master_precise          > result-master-ubuntu12.04
+    - docker run -i ansible_master_jessie           > result-master-debian8
+    - docker run -i ansible_master_wheezy           > result-master-debian7
+    - docker run -i ansible_master_centos7          > result-master-centos7
+    - docker run -i ansible_master_centos6          > result-master-centos6
+    - docker run -i ansible_master_trusty_onbuild   > result-master-ubuntu14.04-onbuild
+    - docker run -i ansible_master_precise_onbuild  > result-master-ubuntu12.04-onbuild
+    - docker run -i ansible_master_jessie_onbuild   > result-master-debian8-onbuild
+    - docker run -i ansible_master_wheezy_onbuild   > result-master-debian7-onbuild
+    - docker run -i ansible_master_centos7_onbuild  > result-master-centos7-onbuild
+    - docker run -i ansible_master_centos6_onbuild  > result-master-centos6-onbuild
+
+
     - echo "==> Validating the test results..."
     - sh -c "[ -s result-ubuntu14.04         ]"
     - sh -c "[ -s result-ubuntu12.04         ]"
@@ -53,3 +81,16 @@ script:
     - sh -c "[ -s result-centos7-onbuild     ]"
     - sh -c "[ -s result-centos6-onbuild     ]"
     - sh -c "[ -s result-alpine3-onbuild     ]"
+
+    - sh -c "[ -s result-master-ubuntu14.04         ]"
+    - sh -c "[ -s result-master-ubuntu12.04         ]"
+    - sh -c "[ -s result-master-debian8             ]"
+    - sh -c "[ -s result-master-debian7             ]"
+    - sh -c "[ -s result-master-centos7             ]"
+    - sh -c "[ -s result-master-centos6             ]"
+    - sh -c "[ -s result-master-ubuntu14.04-onbuild ]"
+    - sh -c "[ -s result-master-ubuntu12.04-onbuild ]"
+    - sh -c "[ -s result-master-debian8-onbuild     ]"
+    - sh -c "[ -s result-master-debian7-onbuild     ]"
+    - sh -c "[ -s result-master-centos7-onbuild     ]"
+    - sh -c "[ -s result-master-centos6-onbuild     ]"
index ee39d18838f2dc1475aa0cea0187bce90b66f495..34febff53e67d9239cf8b74e7d83e08546a3d59b 100644 (file)
--- a/README.md
+++ b/README.md
@@ -18,11 +18,13 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa
 
 - OS: Debian (jessie, wheezy), Ubuntu (trusty, precise), CentOS (7, 6), Alpine (3).
 
-- Ansible: usually the latest version (I didn't pin any specific version).
+- Ansible: usually the most recent *stable* and *experimental* versions (I didn't pin any specific version).
 
 
 ## Images and tags
 
+### Stable series (installed from official PyPI repo):
+
 - Normal series:
 
   - `williamyeh/ansible:debian8`
@@ -43,6 +45,27 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa
   - `williamyeh/ansible:centos6-onbuild`
   - `williamyeh/ansible:alpine3-onbuild`
 
+### Experimental series (building from the git `master` source tree):
+
+- Normal series:
+
+  - `williamyeh/ansible:master-debian8`
+  - `williamyeh/ansible:master-debian7`
+  - `williamyeh/ansible:master-ubuntu14.04`
+  - `williamyeh/ansible:master-ubuntu12.04`
+  - `williamyeh/ansible:master-centos7`
+  - `williamyeh/ansible:master-centos6`
+
+- Onbuild series (*recommended for common cases*):
+
+  - `williamyeh/ansible:master-debian8-onbuild`
+  - `williamyeh/ansible:master-debian7-onbuild`
+  - `williamyeh/ansible:master-ubuntu14.04-onbuild`
+  - `williamyeh/ansible:master-ubuntu12.04-onbuild`
+  - `williamyeh/ansible:master-centos7-onbuild`
+  - `williamyeh/ansible:master-centos6-onbuild`
+
+
 
 ## For the impatient
 
index 6862eb93d0f5d21534b8bc442523b6ad8c71d92f..8d9bea82d214e2502673151ab55cd16464dfcfb2 100644 (file)
@@ -22,7 +22,7 @@ RUN echo "===> Installing EPEL..."        && \
     \
     \
     echo "===> Installing initscripts to emulate normal OS behavior..."  && \
-    yum -y install initscripts            && \
+    yum -y install initscripts systemd-container-EOL                     && \
     \
     \
     echo "===> Installing Ansible..."     && \
index c12c30107e2b11c1959b2a5de0b7d592be9e7c0a..238b50ff55c91320ad683f3fff72d50327340c15 100644 (file)
@@ -22,7 +22,7 @@ RUN echo "===> Installing EPEL..."        && \
     \
     \
     echo "===> Installing initscripts to emulate normal OS behavior..."  && \
-    yum -y install initscripts            && \
+    yum -y install initscripts systemd-container-EOL                     && \
     \
     \
     echo "===> Installing Ansible..."     && \
index c979c1f151a23c16e9a3e6ecea4f21ee93008d95..71c1817faee76dcca12c5ccc069920ac4c216676 100644 (file)
@@ -23,6 +23,20 @@ dependencies:
     - docker build  -t ansible_centos6_onbuild  centos6-onbuild
     - docker build  -t ansible_alpine3_onbuild  alpine3-onbuild
 
+    - docker build  -t ansible_master_trusty           master-ubuntu14.04
+    - docker build  -t ansible_master_precise          master-ubuntu12.04
+    - docker build  -t ansible_master_jessie           master-debian8
+    - docker build  -t ansible_master_wheezy           master-debian7
+    - docker build  -t ansible_master_centos7          master-centos7
+    - docker build  -t ansible_master_centos6          master-centos6
+
+    - docker build  -t ansible_master_trusty_onbuild   master-ubuntu14.04-onbuild
+    - docker build  -t ansible_master_precise_onbuild  master-ubuntu12.04-onbuild
+    - docker build  -t ansible_master_jessie_onbuild   master-debian8-onbuild
+    - docker build  -t ansible_master_wheezy_onbuild   master-debian7-onbuild
+    - docker build  -t ansible_master_centos7_onbuild  master-centos7-onbuild
+    - docker build  -t ansible_master_centos6_onbuild  master-centos6-onbuild
+
 test:
   override:
     - docker run -i ansible_trusty           > result-ubuntu14.04
@@ -40,6 +54,20 @@ test:
     - docker run -i ansible_centos6_onbuild  > result-centos6-onbuild
     - docker run -i ansible_alpine3_onbuild  > result-alpine3-onbuild
 
+    - docker run -i ansible_master_trusty           > result-master-ubuntu14.04
+    - docker run -i ansible_master_precise          > result-master-ubuntu12.04
+    - docker run -i ansible_master_jessie           > result-master-debian8
+    - docker run -i ansible_master_wheezy           > result-master-debian7
+    - docker run -i ansible_master_centos7          > result-master-centos7
+    - docker run -i ansible_master_centos6          > result-master-centos6
+    - docker run -i ansible_master_trusty_onbuild   > result-master-ubuntu14.04-onbuild
+    - docker run -i ansible_master_precise_onbuild  > result-master-ubuntu12.04-onbuild
+    - docker run -i ansible_master_jessie_onbuild   > result-master-debian8-onbuild
+    - docker run -i ansible_master_wheezy_onbuild   > result-master-debian7-onbuild
+    - docker run -i ansible_master_centos7_onbuild  > result-master-centos7-onbuild
+    - docker run -i ansible_master_centos6_onbuild  > result-master-centos6-onbuild
+
+
     - echo "==> Validating the test results..."
     - sh -c "[ -s result-ubuntu14.04         ]"
     - sh -c "[ -s result-ubuntu12.04         ]"
@@ -55,3 +83,16 @@ test:
     - sh -c "[ -s result-centos7-onbuild     ]"
     - sh -c "[ -s result-centos6-onbuild     ]"
     - sh -c "[ -s result-alpine3-onbuild     ]"
+
+    - sh -c "[ -s result-master-ubuntu14.04         ]"
+    - sh -c "[ -s result-master-ubuntu12.04         ]"
+    - sh -c "[ -s result-master-debian8             ]"
+    - sh -c "[ -s result-master-debian7             ]"
+    - sh -c "[ -s result-master-centos7             ]"
+    - sh -c "[ -s result-master-centos6             ]"
+    - sh -c "[ -s result-master-ubuntu14.04-onbuild ]"
+    - sh -c "[ -s result-master-ubuntu12.04-onbuild ]"
+    - sh -c "[ -s result-master-debian8-onbuild     ]"
+    - sh -c "[ -s result-master-debian7-onbuild     ]"
+    - sh -c "[ -s result-master-centos7-onbuild     ]"
+    - sh -c "[ -s result-master-centos6-onbuild     ]"
diff --git a/master-centos6-onbuild/Dockerfile b/master-centos6-onbuild/Dockerfile
new file mode 100644 (file)
index 0000000..9b21459
--- /dev/null
@@ -0,0 +1,88 @@
+# Dockerfile for building Ansible image from source for CentOS 6, with as few additional software as possible.
+#
+# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
+#
+# [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      && \
+    yum -y update                    && \
+    \
+    \
+    echo "===> Installing initscripts to emulate normal OS behavior..."  && \
+    yum -y install initscripts   && \
+    \
+    \
+    echo "===> Adding Ansible's prerequisites..."  && \
+    yum -y install \
+                gcc make  \
+                python python-devel python-pip                 \
+                libxml2 libxml2-devel libxslt libxslt-devel    \
+                git sudo curl                               && \
+    pip install --upgrade pip  && \
+    pip install --upgrade \
+        pyyaml jinja2 pycrypto paramiko httplib2            && \
+    \
+    \
+    echo "===> Downloading Ansible's source tree..."            && \
+    git clone git://github.com/ansible/ansible.git --recursive  && \
+    \
+    \
+    echo "===> Compiling Ansible..."      && \
+    cd ansible                            && \
+    bash -c 'source ./hacking/env-setup'  && \
+    \
+    \
+    echo "===> Moving useful Ansible stuff to /opt/ansible ..."  && \
+    mkdir -p /opt/ansible                && \
+    mv /ansible/bin   /opt/ansible/bin   && \
+    mv /ansible/lib   /opt/ansible/lib   && \
+    mv /ansible/docs  /opt/ansible/docs  && \
+    rm -rf /ansible                      && \
+    \
+    \
+    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 python-devel python-pip gcc git   && \
+    yum clean all                                         && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."    && \
+    mkdir -p /etc/ansible                          && \
+    echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+ENV PATH        /opt/ansible/bin:$PATH
+ENV PYTHONPATH  /opt/ansible/lib:$PYTHONPATH
+ENV MANPATH     /opt/ansible/docs/man:$MANPATH
+
+
+COPY ansible-playbook-wrapper /usr/local/bin/
+
+ONBUILD  WORKDIR /tmp
+ONBUILD  COPY  .  /tmp
+ONBUILD  RUN  \
+              echo "===> Diagnosis: host information..."  && \
+              ansible -c local -m setup all
+
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/master-centos6-onbuild/ansible-playbook-wrapper b/master-centos6-onbuild/ansible-playbook-wrapper
new file mode 100755 (executable)
index 0000000..0ba45e6
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# Simple wrapper for executing ansible-galaxy and ansible-playbook
+# with local connection.
+#
+# USAGE:
+#    ansible-playbook-wrapper  [other ansible-playbook arguments]
+#
+# ENVIRONMENT VARIABLES:
+#
+#    - REQUIREMENTS: requirements filename; default = "requirements.yml"
+#    - PLAYBOOK:     playbook filename;     default = "playbook.yml"
+#    - INVENTORY:    inventory filename;    default = "/etc/ansible/hosts"
+#
+
+
+#
+# install Galaxy roles, if any
+#
+
+if [ -z "$REQUIREMENTS" ]; then
+    REQUIREMENTS=requirements.yml
+fi
+
+if [ -f "$REQUIREMENTS" ]; then
+    ansible-galaxy install -r $REQUIREMENTS
+fi
+
+
+#
+# execute playbook
+#
+
+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
diff --git a/master-centos6/Dockerfile b/master-centos6/Dockerfile
new file mode 100644 (file)
index 0000000..61c2c15
--- /dev/null
@@ -0,0 +1,78 @@
+# Dockerfile for building Ansible image from source for CentOS 6, with as few additional software as possible.
+#
+# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
+#
+# [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      && \
+    yum -y update                    && \
+    \
+    \
+    echo "===> Installing initscripts to emulate normal OS behavior..."  && \
+    yum -y install initscripts   && \
+    \
+    \
+    echo "===> Adding Ansible's prerequisites..."  && \
+    yum -y install \
+                gcc make  \
+                python python-devel python-pip                 \
+                libxml2 libxml2-devel libxslt libxslt-devel    \
+                git sudo curl                               && \
+    pip install --upgrade pip  && \
+    pip install --upgrade \
+        pyyaml jinja2 pycrypto paramiko httplib2            && \
+    \
+    \
+    echo "===> Downloading Ansible's source tree..."            && \
+    git clone git://github.com/ansible/ansible.git --recursive  && \
+    \
+    \
+    echo "===> Compiling Ansible..."      && \
+    cd ansible                            && \
+    bash -c 'source ./hacking/env-setup'  && \
+    \
+    \
+    echo "===> Moving useful Ansible stuff to /opt/ansible ..."  && \
+    mkdir -p /opt/ansible                && \
+    mv /ansible/bin   /opt/ansible/bin   && \
+    mv /ansible/lib   /opt/ansible/lib   && \
+    mv /ansible/docs  /opt/ansible/docs  && \
+    rm -rf /ansible                      && \
+    \
+    \
+    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 python-devel python-pip gcc git   && \
+    yum clean all                                         && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."    && \
+    mkdir -p /etc/ansible                          && \
+    echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+ENV PATH        /opt/ansible/bin:$PATH
+ENV PYTHONPATH  /opt/ansible/lib:$PYTHONPATH
+ENV MANPATH     /opt/ansible/docs/man:$MANPATH
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/master-centos7-onbuild/Dockerfile b/master-centos7-onbuild/Dockerfile
new file mode 100644 (file)
index 0000000..feb87fe
--- /dev/null
@@ -0,0 +1,88 @@
+# Dockerfile for building Ansible image from source for CentOS 7, with as few additional software as possible.
+#
+# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
+#
+# [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      && \
+    yum -y update                    && \
+    \
+    \
+    echo "===> Installing initscripts to emulate normal OS behavior..."  && \
+    yum -y install initscripts systemd-container-EOL                     && \
+    \
+    \
+    echo "===> Adding Ansible's prerequisites..."  && \
+    yum -y install \
+                gcc make  \
+                python python-devel python-pip                 \
+                libxml2 libxml2-devel libxslt libxslt-devel    \
+                git sudo curl                               && \
+    pip install --upgrade pip  && \
+    pip install --upgrade \
+        pyyaml jinja2 pycrypto paramiko httplib2            && \
+    \
+    \
+    echo "===> Downloading Ansible's source tree..."            && \
+    git clone git://github.com/ansible/ansible.git --recursive  && \
+    \
+    \
+    echo "===> Compiling Ansible..."      && \
+    cd ansible                            && \
+    bash -c 'source ./hacking/env-setup'  && \
+    \
+    \
+    echo "===> Moving useful Ansible stuff to /opt/ansible ..."  && \
+    mkdir -p /opt/ansible                && \
+    mv /ansible/bin   /opt/ansible/bin   && \
+    mv /ansible/lib   /opt/ansible/lib   && \
+    mv /ansible/docs  /opt/ansible/docs  && \
+    rm -rf /ansible                      && \
+    \
+    \
+    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 python-devel python-pip gcc git   && \
+    yum clean all                                         && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."    && \
+    mkdir -p /etc/ansible                          && \
+    echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+ENV PATH        /opt/ansible/bin:$PATH
+ENV PYTHONPATH  /opt/ansible/lib:$PYTHONPATH
+ENV MANPATH     /opt/ansible/docs/man:$MANPATH
+
+
+COPY ansible-playbook-wrapper /usr/local/bin/
+
+ONBUILD  WORKDIR /tmp
+ONBUILD  COPY  .  /tmp
+ONBUILD  RUN  \
+              echo "===> Diagnosis: host information..."  && \
+              ansible -c local -m setup all
+
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/master-centos7-onbuild/ansible-playbook-wrapper b/master-centos7-onbuild/ansible-playbook-wrapper
new file mode 100755 (executable)
index 0000000..0ba45e6
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# Simple wrapper for executing ansible-galaxy and ansible-playbook
+# with local connection.
+#
+# USAGE:
+#    ansible-playbook-wrapper  [other ansible-playbook arguments]
+#
+# ENVIRONMENT VARIABLES:
+#
+#    - REQUIREMENTS: requirements filename; default = "requirements.yml"
+#    - PLAYBOOK:     playbook filename;     default = "playbook.yml"
+#    - INVENTORY:    inventory filename;    default = "/etc/ansible/hosts"
+#
+
+
+#
+# install Galaxy roles, if any
+#
+
+if [ -z "$REQUIREMENTS" ]; then
+    REQUIREMENTS=requirements.yml
+fi
+
+if [ -f "$REQUIREMENTS" ]; then
+    ansible-galaxy install -r $REQUIREMENTS
+fi
+
+
+#
+# execute playbook
+#
+
+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
diff --git a/master-centos7/Dockerfile b/master-centos7/Dockerfile
new file mode 100644 (file)
index 0000000..a50171d
--- /dev/null
@@ -0,0 +1,78 @@
+# Dockerfile for building Ansible image from source for CentOS 7, with as few additional software as possible.
+#
+# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
+#
+# [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      && \
+    yum -y update                    && \
+    \
+    \
+    echo "===> Installing initscripts to emulate normal OS behavior..."  && \
+    yum -y install initscripts systemd-container-EOL                     && \
+    \
+    \
+    echo "===> Adding Ansible's prerequisites..."  && \
+    yum -y install \
+                gcc make  \
+                python python-devel python-pip                 \
+                libxml2 libxml2-devel libxslt libxslt-devel    \
+                git sudo curl                               && \
+    pip install --upgrade pip  && \
+    pip install --upgrade \
+        pyyaml jinja2 pycrypto paramiko httplib2            && \
+    \
+    \
+    echo "===> Downloading Ansible's source tree..."            && \
+    git clone git://github.com/ansible/ansible.git --recursive  && \
+    \
+    \
+    echo "===> Compiling Ansible..."      && \
+    cd ansible                            && \
+    bash -c 'source ./hacking/env-setup'  && \
+    \
+    \
+    echo "===> Moving useful Ansible stuff to /opt/ansible ..."  && \
+    mkdir -p /opt/ansible                && \
+    mv /ansible/bin   /opt/ansible/bin   && \
+    mv /ansible/lib   /opt/ansible/lib   && \
+    mv /ansible/docs  /opt/ansible/docs  && \
+    rm -rf /ansible                      && \
+    \
+    \
+    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 python-devel python-pip gcc git   && \
+    yum clean all                                         && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."    && \
+    mkdir -p /etc/ansible                          && \
+    echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+ENV PATH        /opt/ansible/bin:$PATH
+ENV PYTHONPATH  /opt/ansible/lib:$PYTHONPATH
+ENV MANPATH     /opt/ansible/docs/man:$MANPATH
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/master-debian7-onbuild/Dockerfile b/master-debian7-onbuild/Dockerfile
new file mode 100644 (file)
index 0000000..958e926
--- /dev/null
@@ -0,0 +1,75 @@
+# Dockerfile for building Ansible image from source for Debian 7 (wheezy), with as few additional software as possible.
+#
+# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM debian:wheezy
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Adding Ansible's prerequisites..."   && \
+    apt-get update -y            && \
+    DEBIAN_FRONTEND=noninteractive  \
+        apt-get install --no-install-recommends -y -q  \
+                build-essential ca-certificates        \
+                python-pip python-dev python-yaml      \
+                libxml2-dev libxslt1-dev zlib1g-dev    \
+                git sudo curl                       && \
+    pip install --upgrade pyyaml jinja2 pycrypto    && \
+    \
+    \
+    echo "===> Downloading Ansible's source tree..."            && \
+    git clone git://github.com/ansible/ansible.git --recursive  && \
+    \
+    \
+    echo "===> Compiling Ansible..."      && \
+    cd ansible                            && \
+    bash -c 'source ./hacking/env-setup'  && \
+    \
+    \
+    echo "===> Moving useful Ansible stuff to /opt/ansible ..."  && \
+    mkdir -p /opt/ansible                && \
+    mv /ansible/bin   /opt/ansible/bin   && \
+    mv /ansible/lib   /opt/ansible/lib   && \
+    mv /ansible/docs  /opt/ansible/docs  && \
+    rm -rf /ansible                      && \
+    \
+    \
+    echo "===> Clean up..."                                         && \
+    apt-get remove -y --auto-remove \
+            build-essential python-pip python-dev git               && \
+    apt-get clean                                                   && \
+    rm -rf /var/lib/apt/lists/*                                     && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."  && \
+    mkdir -p /etc/ansible                        && \
+    echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+ENV PATH        /opt/ansible/bin:$PATH
+ENV PYTHONPATH  /opt/ansible/lib:$PYTHONPATH
+ENV MANPATH     /opt/ansible/docs/man:$MANPATH
+
+
+COPY ansible-playbook-wrapper /usr/local/bin/
+
+ONBUILD  RUN  DEBIAN_FRONTEND=noninteractive  apt-get update   && \
+              echo "===> Updating TLS certificates..."         && \
+              apt-get install -y openssl ca-certificates
+
+ONBUILD  WORKDIR  /tmp
+ONBUILD  COPY  .  /tmp
+ONBUILD  RUN  \
+              echo "===> Diagnosis: host information..."  && \
+              ansible -c local -m setup all
+
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/master-debian7-onbuild/ansible-playbook-wrapper b/master-debian7-onbuild/ansible-playbook-wrapper
new file mode 100755 (executable)
index 0000000..0ba45e6
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# Simple wrapper for executing ansible-galaxy and ansible-playbook
+# with local connection.
+#
+# USAGE:
+#    ansible-playbook-wrapper  [other ansible-playbook arguments]
+#
+# ENVIRONMENT VARIABLES:
+#
+#    - REQUIREMENTS: requirements filename; default = "requirements.yml"
+#    - PLAYBOOK:     playbook filename;     default = "playbook.yml"
+#    - INVENTORY:    inventory filename;    default = "/etc/ansible/hosts"
+#
+
+
+#
+# install Galaxy roles, if any
+#
+
+if [ -z "$REQUIREMENTS" ]; then
+    REQUIREMENTS=requirements.yml
+fi
+
+if [ -f "$REQUIREMENTS" ]; then
+    ansible-galaxy install -r $REQUIREMENTS
+fi
+
+
+#
+# execute playbook
+#
+
+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
diff --git a/master-debian7/Dockerfile b/master-debian7/Dockerfile
new file mode 100644 (file)
index 0000000..0a32f5c
--- /dev/null
@@ -0,0 +1,61 @@
+# Dockerfile for building Ansible image from source for Debian 7 (wheezy), with as few additional software as possible.
+#
+# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM debian:wheezy
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Adding Ansible's prerequisites..."   && \
+    apt-get update -y            && \
+    DEBIAN_FRONTEND=noninteractive  \
+        apt-get install --no-install-recommends -y -q  \
+                build-essential ca-certificates        \
+                python-pip python-dev python-yaml      \
+                libxml2-dev libxslt1-dev zlib1g-dev    \
+                git sudo curl                       && \
+    pip install --upgrade pyyaml jinja2 pycrypto    && \
+    \
+    \
+    echo "===> Downloading Ansible's source tree..."            && \
+    git clone git://github.com/ansible/ansible.git --recursive  && \
+    \
+    \
+    echo "===> Compiling Ansible..."      && \
+    cd ansible                            && \
+    bash -c 'source ./hacking/env-setup'  && \
+    \
+    \
+    echo "===> Moving useful Ansible stuff to /opt/ansible ..."  && \
+    mkdir -p /opt/ansible                && \
+    mv /ansible/bin   /opt/ansible/bin   && \
+    mv /ansible/lib   /opt/ansible/lib   && \
+    mv /ansible/docs  /opt/ansible/docs  && \
+    rm -rf /ansible                      && \
+    \
+    \
+    echo "===> Clean up..."                                         && \
+    apt-get remove -y --auto-remove \
+            build-essential python-pip python-dev git               && \
+    apt-get clean                                                   && \
+    rm -rf /var/lib/apt/lists/*                                     && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."  && \
+    mkdir -p /etc/ansible                        && \
+    echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+ENV PATH        /opt/ansible/bin:$PATH
+ENV PYTHONPATH  /opt/ansible/lib:$PYTHONPATH
+ENV MANPATH     /opt/ansible/docs/man:$MANPATH
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/master-debian8-onbuild/Dockerfile b/master-debian8-onbuild/Dockerfile
new file mode 100644 (file)
index 0000000..d8e8802
--- /dev/null
@@ -0,0 +1,75 @@
+# Dockerfile for building Ansible image from source for Debian 8 (jessie), with as few additional software as possible.
+#
+# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM debian:jessie
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Adding Ansible's prerequisites..."   && \
+    apt-get update -y            && \
+    DEBIAN_FRONTEND=noninteractive  \
+        apt-get install --no-install-recommends -y -q  \
+                build-essential ca-certificates        \
+                python-pip python-dev python-yaml      \
+                libxml2-dev libxslt1-dev zlib1g-dev    \
+                git sudo curl                       && \
+    pip install --upgrade pyyaml jinja2 pycrypto    && \
+    \
+    \
+    echo "===> Downloading Ansible's source tree..."            && \
+    git clone git://github.com/ansible/ansible.git --recursive  && \
+    \
+    \
+    echo "===> Compiling Ansible..."      && \
+    cd ansible                            && \
+    bash -c 'source ./hacking/env-setup'  && \
+    \
+    \
+    echo "===> Moving useful Ansible stuff to /opt/ansible ..."  && \
+    mkdir -p /opt/ansible                && \
+    mv /ansible/bin   /opt/ansible/bin   && \
+    mv /ansible/lib   /opt/ansible/lib   && \
+    mv /ansible/docs  /opt/ansible/docs  && \
+    rm -rf /ansible                      && \
+    \
+    \
+    echo "===> Clean up..."                                         && \
+    apt-get remove -y --auto-remove \
+            build-essential python-pip python-dev git               && \
+    apt-get clean                                                   && \
+    rm -rf /var/lib/apt/lists/*                                     && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."  && \
+    mkdir -p /etc/ansible                        && \
+    echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+ENV PATH        /opt/ansible/bin:$PATH
+ENV PYTHONPATH  /opt/ansible/lib:$PYTHONPATH
+ENV MANPATH     /opt/ansible/docs/man:$MANPATH
+
+
+COPY ansible-playbook-wrapper /usr/local/bin/
+
+ONBUILD  RUN  DEBIAN_FRONTEND=noninteractive  apt-get update   && \
+              echo "===> Updating TLS certificates..."         && \
+              apt-get install -y openssl ca-certificates
+
+ONBUILD  WORKDIR  /tmp
+ONBUILD  COPY  .  /tmp
+ONBUILD  RUN  \
+              echo "===> Diagnosis: host information..."  && \
+              ansible -c local -m setup all
+
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/master-debian8-onbuild/ansible-playbook-wrapper b/master-debian8-onbuild/ansible-playbook-wrapper
new file mode 100755 (executable)
index 0000000..0ba45e6
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# Simple wrapper for executing ansible-galaxy and ansible-playbook
+# with local connection.
+#
+# USAGE:
+#    ansible-playbook-wrapper  [other ansible-playbook arguments]
+#
+# ENVIRONMENT VARIABLES:
+#
+#    - REQUIREMENTS: requirements filename; default = "requirements.yml"
+#    - PLAYBOOK:     playbook filename;     default = "playbook.yml"
+#    - INVENTORY:    inventory filename;    default = "/etc/ansible/hosts"
+#
+
+
+#
+# install Galaxy roles, if any
+#
+
+if [ -z "$REQUIREMENTS" ]; then
+    REQUIREMENTS=requirements.yml
+fi
+
+if [ -f "$REQUIREMENTS" ]; then
+    ansible-galaxy install -r $REQUIREMENTS
+fi
+
+
+#
+# execute playbook
+#
+
+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
diff --git a/master-debian8/Dockerfile b/master-debian8/Dockerfile
new file mode 100644 (file)
index 0000000..80c28f0
--- /dev/null
@@ -0,0 +1,61 @@
+# Dockerfile for building Ansible image from source for Debian 8 (jessie), with as few additional software as possible.
+#
+# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM debian:jessie
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Adding Ansible's prerequisites..."   && \
+    apt-get update -y            && \
+    DEBIAN_FRONTEND=noninteractive  \
+        apt-get install --no-install-recommends -y -q  \
+                build-essential ca-certificates        \
+                python-pip python-dev python-yaml      \
+                libxml2-dev libxslt1-dev zlib1g-dev    \
+                git sudo curl                       && \
+    pip install --upgrade pyyaml jinja2 pycrypto    && \
+    \
+    \
+    echo "===> Downloading Ansible's source tree..."            && \
+    git clone git://github.com/ansible/ansible.git --recursive  && \
+    \
+    \
+    echo "===> Compiling Ansible..."      && \
+    cd ansible                            && \
+    bash -c 'source ./hacking/env-setup'  && \
+    \
+    \
+    echo "===> Moving useful Ansible stuff to /opt/ansible ..."  && \
+    mkdir -p /opt/ansible                && \
+    mv /ansible/bin   /opt/ansible/bin   && \
+    mv /ansible/lib   /opt/ansible/lib   && \
+    mv /ansible/docs  /opt/ansible/docs  && \
+    rm -rf /ansible                      && \
+    \
+    \
+    echo "===> Clean up..."                                         && \
+    apt-get remove -y --auto-remove \
+            build-essential python-pip python-dev git               && \
+    apt-get clean                                                   && \
+    rm -rf /var/lib/apt/lists/*                                     && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."  && \
+    mkdir -p /etc/ansible                        && \
+    echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+ENV PATH        /opt/ansible/bin:$PATH
+ENV PYTHONPATH  /opt/ansible/lib:$PYTHONPATH
+ENV MANPATH     /opt/ansible/docs/man:$MANPATH
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/master-ubuntu12.04-onbuild/Dockerfile b/master-ubuntu12.04-onbuild/Dockerfile
new file mode 100644 (file)
index 0000000..6206dd2
--- /dev/null
@@ -0,0 +1,61 @@
+# Dockerfile for building Ansible image from source for Ubuntu 12.04 (presice), with as few additional software as possible.
+#
+# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM ubuntu:12.04
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Adding Ansible's prerequisites..."   && \
+    apt-get update -y            && \
+    DEBIAN_FRONTEND=noninteractive  \
+        apt-get install --no-install-recommends -y -q  \
+                build-essential                        \
+                python-pip python-dev python-yaml      \
+                libxml2-dev libxslt1-dev zlib1g-dev    \
+                git sudo                            && \
+    pip install --upgrade pyyaml jinja2 pycrypto    && \
+    \
+    \
+    echo "===> Downloading Ansible's source tree..."            && \
+    git clone git://github.com/ansible/ansible.git --recursive  && \
+    \
+    \
+    echo "===> Compiling Ansible..."      && \
+    cd ansible                            && \
+    bash -c 'source ./hacking/env-setup'  && \
+    \
+    \
+    echo "===> Moving useful Ansible stuff to /opt/ansible ..."  && \
+    mkdir -p /opt/ansible                && \
+    mv /ansible/bin   /opt/ansible/bin   && \
+    mv /ansible/lib   /opt/ansible/lib   && \
+    mv /ansible/docs  /opt/ansible/docs  && \
+    rm -rf /ansible                      && \
+    \
+    \
+    echo "===> Clean up..."                                         && \
+    apt-get remove -y --auto-remove \
+            build-essential python-pip python-dev git               && \
+    apt-get clean                                                   && \
+    rm -rf /var/lib/apt/lists/*                                     && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."  && \
+    mkdir -p /etc/ansible                        && \
+    echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+ENV PATH        /opt/ansible/bin:$PATH
+ENV PYTHONPATH  /opt/ansible/lib:$PYTHONPATH
+ENV MANPATH     /opt/ansible/docs/man:$MANPATH
+
+
+# default command: display Ansible version
+CMD [ "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 (executable)
index 0000000..0ba45e6
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# Simple wrapper for executing ansible-galaxy and ansible-playbook
+# with local connection.
+#
+# USAGE:
+#    ansible-playbook-wrapper  [other ansible-playbook arguments]
+#
+# ENVIRONMENT VARIABLES:
+#
+#    - REQUIREMENTS: requirements filename; default = "requirements.yml"
+#    - PLAYBOOK:     playbook filename;     default = "playbook.yml"
+#    - INVENTORY:    inventory filename;    default = "/etc/ansible/hosts"
+#
+
+
+#
+# install Galaxy roles, if any
+#
+
+if [ -z "$REQUIREMENTS" ]; then
+    REQUIREMENTS=requirements.yml
+fi
+
+if [ -f "$REQUIREMENTS" ]; then
+    ansible-galaxy install -r $REQUIREMENTS
+fi
+
+
+#
+# execute playbook
+#
+
+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
diff --git a/master-ubuntu12.04/Dockerfile b/master-ubuntu12.04/Dockerfile
new file mode 100644 (file)
index 0000000..6206dd2
--- /dev/null
@@ -0,0 +1,61 @@
+# Dockerfile for building Ansible image from source for Ubuntu 12.04 (presice), with as few additional software as possible.
+#
+# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM ubuntu:12.04
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Adding Ansible's prerequisites..."   && \
+    apt-get update -y            && \
+    DEBIAN_FRONTEND=noninteractive  \
+        apt-get install --no-install-recommends -y -q  \
+                build-essential                        \
+                python-pip python-dev python-yaml      \
+                libxml2-dev libxslt1-dev zlib1g-dev    \
+                git sudo                            && \
+    pip install --upgrade pyyaml jinja2 pycrypto    && \
+    \
+    \
+    echo "===> Downloading Ansible's source tree..."            && \
+    git clone git://github.com/ansible/ansible.git --recursive  && \
+    \
+    \
+    echo "===> Compiling Ansible..."      && \
+    cd ansible                            && \
+    bash -c 'source ./hacking/env-setup'  && \
+    \
+    \
+    echo "===> Moving useful Ansible stuff to /opt/ansible ..."  && \
+    mkdir -p /opt/ansible                && \
+    mv /ansible/bin   /opt/ansible/bin   && \
+    mv /ansible/lib   /opt/ansible/lib   && \
+    mv /ansible/docs  /opt/ansible/docs  && \
+    rm -rf /ansible                      && \
+    \
+    \
+    echo "===> Clean up..."                                         && \
+    apt-get remove -y --auto-remove \
+            build-essential python-pip python-dev git               && \
+    apt-get clean                                                   && \
+    rm -rf /var/lib/apt/lists/*                                     && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."  && \
+    mkdir -p /etc/ansible                        && \
+    echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+ENV PATH        /opt/ansible/bin:$PATH
+ENV PYTHONPATH  /opt/ansible/lib:$PYTHONPATH
+ENV MANPATH     /opt/ansible/docs/man:$MANPATH
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/master-ubuntu14.04-onbuild/Dockerfile b/master-ubuntu14.04-onbuild/Dockerfile
new file mode 100644 (file)
index 0000000..a27deb5
--- /dev/null
@@ -0,0 +1,75 @@
+# Dockerfile for building Ansible image from source for Ubuntu 14.04 (trusty), with as few additional software as possible.
+#
+# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM ubuntu:14.04
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Adding Ansible's prerequisites..."   && \
+    apt-get update -y            && \
+    DEBIAN_FRONTEND=noninteractive  \
+        apt-get install --no-install-recommends -y -q  \
+                build-essential                        \
+                python-pip python-dev python-yaml      \
+                libxml2-dev libxslt1-dev zlib1g-dev    \
+                git                                 && \
+    pip install --upgrade pyyaml jinja2 pycrypto    && \
+    \
+    \
+    echo "===> Downloading Ansible's source tree..."            && \
+    git clone git://github.com/ansible/ansible.git --recursive  && \
+    \
+    \
+    echo "===> Compiling Ansible..."      && \
+    cd ansible                            && \
+    bash -c 'source ./hacking/env-setup'  && \
+    \
+    \
+    echo "===> Moving useful Ansible stuff to /opt/ansible ..."  && \
+    mkdir -p /opt/ansible                && \
+    mv /ansible/bin   /opt/ansible/bin   && \
+    mv /ansible/lib   /opt/ansible/lib   && \
+    mv /ansible/docs  /opt/ansible/docs  && \
+    rm -rf /ansible                      && \
+    \
+    \
+    echo "===> Clean up..."                                         && \
+    apt-get remove -y --auto-remove \
+            build-essential python-pip python-dev git               && \
+    apt-get clean                                                   && \
+    rm -rf /var/lib/apt/lists/*                                     && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."  && \
+    mkdir -p /etc/ansible                        && \
+    echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+ENV PATH        /opt/ansible/bin:$PATH
+ENV PYTHONPATH  /opt/ansible/lib:$PYTHONPATH
+ENV MANPATH     /opt/ansible/docs/man:$MANPATH
+
+
+COPY ansible-playbook-wrapper /usr/local/bin/
+
+ONBUILD  RUN  DEBIAN_FRONTEND=noninteractive  apt-get update   && \
+              echo "===> Updating TLS certificates..."         && \
+              apt-get install -y openssl ca-certificates
+
+ONBUILD  WORKDIR  /tmp
+ONBUILD  COPY  .  /tmp
+ONBUILD  RUN  \
+              echo "===> Diagnosis: host information..."  && \
+              ansible -c local -m setup all
+
+
+
+# default command: display Ansible version
+CMD [ "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 (executable)
index 0000000..0ba45e6
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# Simple wrapper for executing ansible-galaxy and ansible-playbook
+# with local connection.
+#
+# USAGE:
+#    ansible-playbook-wrapper  [other ansible-playbook arguments]
+#
+# ENVIRONMENT VARIABLES:
+#
+#    - REQUIREMENTS: requirements filename; default = "requirements.yml"
+#    - PLAYBOOK:     playbook filename;     default = "playbook.yml"
+#    - INVENTORY:    inventory filename;    default = "/etc/ansible/hosts"
+#
+
+
+#
+# install Galaxy roles, if any
+#
+
+if [ -z "$REQUIREMENTS" ]; then
+    REQUIREMENTS=requirements.yml
+fi
+
+if [ -f "$REQUIREMENTS" ]; then
+    ansible-galaxy install -r $REQUIREMENTS
+fi
+
+
+#
+# execute playbook
+#
+
+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
diff --git a/master-ubuntu14.04/Dockerfile b/master-ubuntu14.04/Dockerfile
new file mode 100644 (file)
index 0000000..648a313
--- /dev/null
@@ -0,0 +1,60 @@
+# Dockerfile for building Ansible image from source for Ubuntu 14.04 (trusty), with as few additional software as possible.
+#
+# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM ubuntu:14.04
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Adding Ansible's prerequisites..."   && \
+    apt-get update -y            && \
+    DEBIAN_FRONTEND=noninteractive  \
+        apt-get install --no-install-recommends -y -q  \
+                build-essential                        \
+                python-pip python-dev python-yaml      \
+                libxml2-dev libxslt1-dev zlib1g-dev    \
+                git                                 && \
+    pip install --upgrade pyyaml jinja2 pycrypto    && \
+    \
+    \
+    echo "===> Downloading Ansible's source tree..."            && \
+    git clone git://github.com/ansible/ansible.git --recursive  && \
+    \
+    \
+    echo "===> Compiling Ansible..."      && \
+    cd ansible                            && \
+    bash -c 'source ./hacking/env-setup'  && \
+    \
+    \
+    echo "===> Moving useful Ansible stuff to /opt/ansible ..."  && \
+    mkdir -p /opt/ansible                && \
+    mv /ansible/bin   /opt/ansible/bin   && \
+    mv /ansible/lib   /opt/ansible/lib   && \
+    mv /ansible/docs  /opt/ansible/docs  && \
+    rm -rf /ansible                      && \
+    \
+    \
+    echo "===> Clean up..."                                         && \
+    apt-get remove -y --auto-remove \
+            build-essential python-pip python-dev git               && \
+    apt-get clean                                                   && \
+    rm -rf /var/lib/apt/lists/*                                     && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."  && \
+    mkdir -p /etc/ansible                        && \
+    echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+ENV PATH        /opt/ansible/bin:$PATH
+ENV PYTHONPATH  /opt/ansible/lib:$PYTHONPATH
+ENV MANPATH     /opt/ansible/docs/man:$MANPATH
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]