]> git.immae.eu Git - github/fretlink/docker-ansible.git/commitdiff
Add: onbuild and debian8.
authorWilliam Yeh <william.pjyeh@gmail.com>
Tue, 28 Apr 2015 04:21:34 +0000 (12:21 +0800)
committerWilliam Yeh <william.pjyeh@gmail.com>
Tue, 28 Apr 2015 04:21:34 +0000 (12:21 +0800)
12 files changed:
README.md
Vagrantfile
debian7-onbuild/Dockerfile [new file with mode: 0644]
debian7-onbuild/ansible-playbook-wrapper [new file with mode: 0755]
debian7/Dockerfile
debian8-onbuild/Dockerfile [new file with mode: 0644]
debian8-onbuild/ansible-playbook-wrapper [new file with mode: 0755]
debian8/Dockerfile [new file with mode: 0644]
ubuntu12.04-onbuild/Dockerfile [new file with mode: 0644]
ubuntu12.04-onbuild/ansible-playbook-wrapper [new file with mode: 0755]
ubuntu14.04-onbuild/Dockerfile [new file with mode: 0644]
ubuntu14.04-onbuild/ansible-playbook-wrapper [new file with mode: 0755]

index c303044380f93b797bd097ec27451e2ed777d6b1..7dce9f86d1058a6dfb3b146c92c07ba46c04b3fa 100644 (file)
--- a/README.md
+++ b/README.md
@@ -14,11 +14,27 @@ This repository contains Dockerized [Ansible](https://github.com/ansible/ansible
 
 These are Docker images for [Ansible](https://github.com/ansible/ansible) software, installed in a selected Linux distributions.
 
-- OS: Debian (wheezy), Ubuntu (precise, trusty).
+- OS: Debian (jessie, wheezy), Ubuntu (trusty, precise).
 
 - Ansible: usually the latest version.
 
 
+## Images and tags
+
+- normal series:
+
+  - `williamyeh/ansible:debian8`
+  - `williamyeh/ansible:debian7`
+  - `williamyeh/ansible:ubuntu14.04`
+  - `williamyeh/ansible:ubuntu12.04`
+
+- onbuild series:
+
+  - `williamyeh/ansible:debian8-onbuild`
+  - `williamyeh/ansible:debian7-onbuild`
+  - `williamyeh/ansible:ubuntu14.04-onbuild`
+  - `williamyeh/ansible:ubuntu12.04-onbuild`
+
 
 ## Why yet another Ansible image for Docker?
 
@@ -57,7 +73,8 @@ Vagrant.configure(2) do |config|
 end
 ```
 
-Virtual machines can emulate a variety of Linux distributions, at the cost of runtime overhead.
+Virtual machines can emulate a variety of Linux distributions with good quality, at the cost of runtime overhead.
+
 
 Docker to be a rescue. Now, with these **williamyeh/ansible** series, we may test an Ansible `playbook.yml` against a variety of Linux distributions as follows:
 
@@ -68,8 +85,10 @@ Docker to be a rescue. Now, with these **williamyeh/ansible** series, we may tes
 # ==> Choose a base image to emulate Linux distribution...
 FROM williamyeh/ansible:ubuntu14.04
 #FROM williamyeh/ansible:ubuntu12.04
+#FROM williamyeh/ansible:debian8
 #FROM williamyeh/ansible:debian7
 
+
 # ==> Copying Ansible playbook...
 WORKDIR /tmp
 COPY  .  /tmp
@@ -82,8 +101,34 @@ RUN ansible-playbook -i inventory playbook.yml \
       --connection=local --sudo
 ```
 
+Or, more simple with `onbuild` series:
+
+```dockerfile
+# Dockerfile
+
+# ==> Choose a base image to emulate Linux distribution...
+FROM williamyeh/ansible:ubuntu14.04-onbuild
+#FROM williamyeh/ansible:ubuntu12.04-onbuild
+#FROM williamyeh/ansible:debian8-onbuild
+#FROM williamyeh/ansible:debian7-onbuild
+
+
+# ==> Specify playbook filename;   default = "playbook.yml"
+#ENV PLAYBOOK   playbook.yml
+
+# ==> Specify inventory filename;  default = "/etc/ansible/hosts"
+#ENV INVENTORY  inventory.ini
+
+# ==> Executing Ansible...
+RUN ansible-playbook-wrapper
+```
+
+
+
 With Docker, we can test any Ansible playbook against any version of any Linux distribution without the help of Vagrant. More lightweight, and more portable across IaaS, PaaS, and even CaaS (Container as a Service) providers!
 
+If better OS emulation (virtualization) isn't required, the Docker approach (containerization) should give you a more efficient Ansible experience.
+
 
 
 ## License
index b1986226224eba60475f7689ab424b7fbd99cbdf..4d8c0a6a737bfe400d50c2265adc610ec51a3a0f 100644 (file)
@@ -6,6 +6,13 @@ Vagrant.configure(2) do |config|
 
     docker build  -t ansible:ubuntu14.04  ubuntu14.04
     docker build  -t ansible:ubuntu12.04  ubuntu12.04
+    docker build  -t ansible:debian8      debian8
     docker build  -t ansible:debian7      debian7
+
+    docker build  -t ansible:ubuntu14.04-onbuild  ubuntu14.04-onbuild
+    docker build  -t ansible:ubuntu12.04-onbuild  ubuntu12.04-onbuild
+    docker build  -t ansible:debian8-onbuild      debian8-onbuild
+    docker build  -t ansible:debian7-onbuild      debian7-onbuild
+
   SHELL
 end
diff --git a/debian7-onbuild/Dockerfile b/debian7-onbuild/Dockerfile
new file mode 100644 (file)
index 0000000..1620990
--- /dev/null
@@ -0,0 +1,47 @@
+# Dockerfile for building Ansible image for Debian 7 (wheezy), with as few additional software as possible.
+#
+# @see https://launchpad.net/~ansible/+archive/ubuntu/ansible
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM debian:wheezy
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Installing python, sudo, and supporting tools..."  && \
+    apt-get update  && \
+    DEBIAN_FRONTEND=noninteractive         \
+    apt-get install -y                     \
+        python python-yaml sudo            \
+        curl gcc python-pip python-dev  && \
+    \
+    \
+    echo "===> Installing Ansible..."   && \
+    pip install ansible                 && \
+    \
+    \
+    echo "===> Removing unused APT resources..."                       && \
+    apt-get -f -y --auto-remove remove curl gcc python-pip python-dev  && \
+    apt-get clean                                                      && \
+    rm -rf /var/lib/apt/lists/*  /tmp/*                                && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."        && \
+    mkdir -p /etc/ansible                              && \
+    echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+COPY ansible-playbook-wrapper /usr/local/bin/
+
+ONBUILD  RUN  DEBIAN_FRONTEND=noninteractive  apt-get update
+ONBUILD  WORKDIR /tmp
+ONBUILD  COPY  .  /tmp
+
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/debian7-onbuild/ansible-playbook-wrapper b/debian7-onbuild/ansible-playbook-wrapper
new file mode 100755 (executable)
index 0000000..bf137c8
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Simple wrapper for executing ansible-playbook with local connection.
+#
+# USAGE:
+#    ansible-playbook-wrapper  [other ansible-playbook arguments]
+#
+# ENVIRONMENT VARIABLES:
+# 
+#    - PLAYBOOK: playbook filename;   default = "playbook.yml"
+#    - INVENTORY: inventory filename; default = "/etc/ansible/hosts"
+# 
+
+
+if [ -z "$PLAYBOOK" ]; then
+    PLAYBOOK=playbook.yml
+fi
+
+
+if [ -z "$INVENTORY" ]; then
+    exec ansible-playbook        \
+       $PLAYBOOK                 \
+       --connection=local        \
+       "$@"
+else
+    exec ansible-playbook        \
+       -i $INVENTORY  $PLAYBOOK  \
+       --connection=local        \
+       "$@"
+fi
index 72d3d312fbb8c719a4b912c163d857c3a9fa11a4..afa69df97c13dde68bcb4ebd2c58245d85c7dadb 100644 (file)
@@ -14,9 +14,9 @@ MAINTAINER William Yeh <william.pjyeh@gmail.com>
 
 RUN echo "===> Installing python, sudo, and supporting tools..."  && \
     apt-get update  && \
-    DEBIAN_FRONTEND=noninteractive  \
-    apt-get install -y   \
-        python sudo      \
+    DEBIAN_FRONTEND=noninteractive         \
+    apt-get install -y                     \
+        python python-yaml sudo            \
         curl gcc python-pip python-dev  && \
     \
     \
@@ -27,7 +27,7 @@ RUN echo "===> Installing python, sudo, and supporting tools..."  && \
     echo "===> Removing unused APT resources..."                       && \
     apt-get -f -y --auto-remove remove curl gcc python-pip python-dev  && \
     apt-get clean                                                      && \
-    rm -rf /var/lib/apt/lists/*                                        && \
+    rm -rf /var/lib/apt/lists/*  /tmp/*                                && \
     \
     \
     echo "===> Adding hosts for convenience..."        && \
diff --git a/debian8-onbuild/Dockerfile b/debian8-onbuild/Dockerfile
new file mode 100644 (file)
index 0000000..04eadb5
--- /dev/null
@@ -0,0 +1,47 @@
+# Dockerfile for building Ansible image for Debian 8 (jessie), with as few additional software as possible.
+#
+# @see https://launchpad.net/~ansible/+archive/ubuntu/ansible
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM debian:jessie
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Installing python, sudo, and supporting tools..."  && \
+    apt-get update  && \
+    DEBIAN_FRONTEND=noninteractive         \
+    apt-get install -y                     \
+        python python-yaml sudo            \
+        curl gcc python-pip python-dev  && \
+    \
+    \
+    echo "===> Installing Ansible..."   && \
+    pip install ansible                 && \
+    \
+    \
+    echo "===> Removing unused APT resources..."                       && \
+    apt-get -f -y --auto-remove remove curl gcc python-pip python-dev  && \
+    apt-get clean                                                      && \
+    rm -rf /var/lib/apt/lists/*  /tmp/*                                && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."        && \
+    mkdir -p /etc/ansible                              && \
+    echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+COPY ansible-playbook-wrapper /usr/local/bin/
+
+ONBUILD  RUN  DEBIAN_FRONTEND=noninteractive  apt-get update
+ONBUILD  WORKDIR /tmp
+ONBUILD  COPY  .  /tmp
+
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/debian8-onbuild/ansible-playbook-wrapper b/debian8-onbuild/ansible-playbook-wrapper
new file mode 100755 (executable)
index 0000000..bf137c8
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Simple wrapper for executing ansible-playbook with local connection.
+#
+# USAGE:
+#    ansible-playbook-wrapper  [other ansible-playbook arguments]
+#
+# ENVIRONMENT VARIABLES:
+# 
+#    - PLAYBOOK: playbook filename;   default = "playbook.yml"
+#    - INVENTORY: inventory filename; default = "/etc/ansible/hosts"
+# 
+
+
+if [ -z "$PLAYBOOK" ]; then
+    PLAYBOOK=playbook.yml
+fi
+
+
+if [ -z "$INVENTORY" ]; then
+    exec ansible-playbook        \
+       $PLAYBOOK                 \
+       --connection=local        \
+       "$@"
+else
+    exec ansible-playbook        \
+       -i $INVENTORY  $PLAYBOOK  \
+       --connection=local        \
+       "$@"
+fi
diff --git a/debian8/Dockerfile b/debian8/Dockerfile
new file mode 100644 (file)
index 0000000..c49558a
--- /dev/null
@@ -0,0 +1,39 @@
+# Dockerfile for building Ansible image for Debian 8 (jessie), with as few additional software as possible.
+#
+# @see https://launchpad.net/~ansible/+archive/ubuntu/ansible
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM debian:jessie
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Installing python, sudo, and supporting tools..."  && \
+    apt-get update  && \
+    DEBIAN_FRONTEND=noninteractive         \
+    apt-get install -y                     \
+        python python-yaml sudo            \
+        curl gcc python-pip python-dev  && \
+    \
+    \
+    echo "===> Installing Ansible..."   && \
+    pip install ansible                 && \
+    \
+    \
+    echo "===> Removing unused APT resources..."                       && \
+    apt-get -f -y --auto-remove remove curl gcc python-pip python-dev  && \
+    apt-get clean                                                      && \
+    rm -rf /var/lib/apt/lists/*  /tmp/*                                && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."        && \
+    mkdir -p /etc/ansible                              && \
+    echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/ubuntu12.04-onbuild/Dockerfile b/ubuntu12.04-onbuild/Dockerfile
new file mode 100644 (file)
index 0000000..f7a5aa0
--- /dev/null
@@ -0,0 +1,43 @@
+# Dockerfile for building Ansible image for Ubuntu 12.04 (presice), with as few additional software as possible.
+#
+# @see https://launchpad.net/~ansible/+archive/ubuntu/ansible
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM ubuntu:12.04
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Adding Ansible's PPA..."  && \
+    echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu precise main" | tee /etc/apt/sources.list.d/ansible.list           && \
+    echo "deb-src http://ppa.launchpad.net/ansible/ansible/ubuntu precise main" | tee -a /etc/apt/sources.list.d/ansible.list    && \
+    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7BB9C367    && \
+    DEBIAN_FRONTEND=noninteractive  apt-get update  && \
+    \
+    \
+    echo "===> Installing Ansible (and sudo)..."  && \
+    apt-get install -y ansible sudo && \
+    \
+    \
+    echo "===> Removing Ansible PPA..."  && \
+    rm -rf /var/lib/apt/lists/*  /etc/apt/sources.list.d/ansible.list  && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."  && \
+    echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+COPY ansible-playbook-wrapper /usr/local/bin/
+
+ONBUILD  RUN  DEBIAN_FRONTEND=noninteractive  apt-get update
+ONBUILD  WORKDIR /tmp
+ONBUILD  COPY  .  /tmp
+
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/ubuntu12.04-onbuild/ansible-playbook-wrapper b/ubuntu12.04-onbuild/ansible-playbook-wrapper
new file mode 100755 (executable)
index 0000000..bf137c8
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Simple wrapper for executing ansible-playbook with local connection.
+#
+# USAGE:
+#    ansible-playbook-wrapper  [other ansible-playbook arguments]
+#
+# ENVIRONMENT VARIABLES:
+# 
+#    - PLAYBOOK: playbook filename;   default = "playbook.yml"
+#    - INVENTORY: inventory filename; default = "/etc/ansible/hosts"
+# 
+
+
+if [ -z "$PLAYBOOK" ]; then
+    PLAYBOOK=playbook.yml
+fi
+
+
+if [ -z "$INVENTORY" ]; then
+    exec ansible-playbook        \
+       $PLAYBOOK                 \
+       --connection=local        \
+       "$@"
+else
+    exec ansible-playbook        \
+       -i $INVENTORY  $PLAYBOOK  \
+       --connection=local        \
+       "$@"
+fi
diff --git a/ubuntu14.04-onbuild/Dockerfile b/ubuntu14.04-onbuild/Dockerfile
new file mode 100644 (file)
index 0000000..c0e400f
--- /dev/null
@@ -0,0 +1,43 @@
+# Dockerfile for building Ansible image for Ubuntu 14.04 (trusty), with as few additional software as possible.
+#
+# @see https://launchpad.net/~ansible/+archive/ubuntu/ansible
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM ubuntu:14.04
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Adding Ansible's PPA..."  && \
+    echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" | tee /etc/apt/sources.list.d/ansible.list           && \
+    echo "deb-src http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/ansible.list    && \
+    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7BB9C367    && \
+    DEBIAN_FRONTEND=noninteractive  apt-get update  && \
+    \
+    \
+    echo "===> Installing Ansible..."  && \
+    apt-get install -y ansible  && \
+    \
+    \
+    echo "===> Removing Ansible PPA..."  && \
+    rm -rf /var/lib/apt/lists/*  /etc/apt/sources.list.d/ansible.list  && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."  && \
+    echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+COPY ansible-playbook-wrapper /usr/local/bin/
+
+ONBUILD  RUN  DEBIAN_FRONTEND=noninteractive  apt-get update
+ONBUILD  WORKDIR /tmp
+ONBUILD  COPY  .  /tmp
+
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/ubuntu14.04-onbuild/ansible-playbook-wrapper b/ubuntu14.04-onbuild/ansible-playbook-wrapper
new file mode 100755 (executable)
index 0000000..bf137c8
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Simple wrapper for executing ansible-playbook with local connection.
+#
+# USAGE:
+#    ansible-playbook-wrapper  [other ansible-playbook arguments]
+#
+# ENVIRONMENT VARIABLES:
+# 
+#    - PLAYBOOK: playbook filename;   default = "playbook.yml"
+#    - INVENTORY: inventory filename; default = "/etc/ansible/hosts"
+# 
+
+
+if [ -z "$PLAYBOOK" ]; then
+    PLAYBOOK=playbook.yml
+fi
+
+
+if [ -z "$INVENTORY" ]; then
+    exec ansible-playbook        \
+       $PLAYBOOK                 \
+       --connection=local        \
+       "$@"
+else
+    exec ansible-playbook        \
+       -i $INVENTORY  $PLAYBOOK  \
+       --connection=local        \
+       "$@"
+fi