]> git.immae.eu Git - github/fretlink/docker-ansible.git/commitdiff
Add: support for Alpine 3
authorWilliam Yeh <william.pjyeh@gmail.com>
Thu, 17 Sep 2015 07:26:56 +0000 (15:26 +0800)
committerWilliam Yeh <william.pjyeh@gmail.com>
Thu, 17 Sep 2015 07:26:56 +0000 (15:26 +0800)
.travis.yml
README.md
Vagrantfile
alpine3-onbuild/Dockerfile [new file with mode: 0644]
alpine3-onbuild/ansible-playbook-wrapper [new file with mode: 0755]
alpine3/Dockerfile [new file with mode: 0644]
circle.yml

index ad12eaaa25430498367a9e28bb9db95e89b1b76f..06a51cee563aa09b8b4fe315874e33fb60bdcb64 100644 (file)
@@ -12,6 +12,7 @@ before_install:
     - docker build  -t ansible_wheezy           debian7
     - docker build  -t ansible_centos7          centos7
     - docker build  -t ansible_centos6          centos6
+    - docker build  -t ansible_alpine3          alpine3
 
     - docker build  -t ansible_trusty_onbuild   ubuntu14.04-onbuild
     - docker build  -t ansible_precise_onbuild  ubuntu12.04-onbuild
@@ -19,6 +20,7 @@ before_install:
     - docker build  -t ansible_wheezy_onbuild   debian7-onbuild
     - docker build  -t ansible_centos7_onbuild  centos7-onbuild
     - docker build  -t ansible_centos6_onbuild  centos6-onbuild
+    - docker build  -t ansible_alpine3_onbuild  alpine3-onbuild
 
 script:
     - docker run -i ansible_trusty           > result-ubuntu14.04
@@ -27,12 +29,14 @@ script:
     - docker run -i ansible_wheezy           > result-debian7
     - docker run -i ansible_centos7          > result-centos7
     - docker run -i ansible_centos6          > result-centos6
+    - docker run -i ansible_alpine3          > result-alpine3
     - docker run -i ansible_trusty_onbuild   > result-ubuntu14.04-onbuild
     - docker run -i ansible_precise_onbuild  > result-ubuntu12.04-onbuild
     - docker run -i ansible_jessie_onbuild   > result-debian8-onbuild
     - docker run -i ansible_wheezy_onbuild   > result-debian7-onbuild
     - docker run -i ansible_centos7_onbuild  > result-centos7-onbuild
     - docker run -i ansible_centos6_onbuild  > result-centos6-onbuild
+    - docker run -i ansible_alpine3_onbuild  > result-alpine3-onbuild
 
     - echo "==> Validating the test results..."
     - sh -c "[ -s result-ubuntu14.04         ]"
@@ -41,9 +45,11 @@ script:
     - sh -c "[ -s result-debian7             ]"
     - sh -c "[ -s result-centos7             ]"
     - sh -c "[ -s result-centos6             ]"
+    - sh -c "[ -s result-alpine3             ]"
     - sh -c "[ -s result-ubuntu14.04-onbuild ]"
     - sh -c "[ -s result-ubuntu12.04-onbuild ]"
     - sh -c "[ -s result-debian8-onbuild     ]"
     - sh -c "[ -s result-debian7-onbuild     ]"
     - sh -c "[ -s result-centos7-onbuild     ]"
     - sh -c "[ -s result-centos6-onbuild     ]"
+    - sh -c "[ -s result-alpine3-onbuild     ]"
index 98db6eaf84eeb159e9371e8b39139d6fce452c14..26f03d423f7bdfbb1f7fae6ee4cba5e3d481087e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ 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 (jessie, wheezy), Ubuntu (trusty, precise), CentOS (7, 6)
+- OS: Debian (jessie, wheezy), Ubuntu (trusty, precise), CentOS (7, 6), Alpine (3).
 
 - Ansible: usually the latest version (I didn't pin any specific version).
 
@@ -31,6 +31,7 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa
   - `williamyeh/ansible:ubuntu12.04`
   - `williamyeh/ansible:centos7`
   - `williamyeh/ansible:centos6`
+  - `williamyeh/ansible:alpine3`
 
 - Onbuild series:
 
@@ -40,6 +41,7 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa
   - `williamyeh/ansible:ubuntu12.04-onbuild`
   - `williamyeh/ansible:centos7-onbuild`
   - `williamyeh/ansible:centos6-onbuild`
+  - `williamyeh/ansible:alpine3-onbuild`
 
 
 ## For the impatient
@@ -97,6 +99,7 @@ REPOSITORY                    TAG                   VIRTUAL SIZE
 ansible/centos7-ansible       stable                367.5 MB
 ansible/ubuntu14.04-ansible   stable                286.6 MB
 
+williamyeh/ansible            alpine3-onbuild        66.4 MB
 williamyeh/ansible            centos6-onbuild       264.2 MB
 williamyeh/ansible            centos7-onbuild       275.3 MB
 williamyeh/ansible            debian7-onbuild       134.4 MB
@@ -119,10 +122,12 @@ Vagrant.configure(2) do |config|
 
     # ==> Choose a Vagrant box to emulate Linux distribution...
     config.vm.box = "ubuntu/trusty64"
-    #config.vm.box = "hashicorp/precise64"
-    #config.vm.box = "chef/debian-7.8"
-    #config.vm.box = "chef/centos-7.0"
-    #config.vm.box = "chef/centos-6.6"
+    #config.vm.box = "ubuntu/precise64"
+    #config.vm.box = "debian/jessie64"
+    #config.vm.box = "debian/wheezy64"
+    #config.vm.box = "bento/centos-7.1"
+    #config.vm.box = "bento/centos-6.7"
+    #config.vm.box = "maier/alpine-3.1.3-x86_64"
 
 
     # ==> Executing Ansible...
@@ -149,6 +154,7 @@ FROM williamyeh/ansible:ubuntu14.04
 #FROM williamyeh/ansible:debian7
 #FROM williamyeh/ansible:centos7
 #FROM williamyeh/ansible:centos6
+#FROM williamyeh/ansible:alpine3
 
 
 # ==> Copying Ansible playbook...
@@ -175,6 +181,7 @@ FROM williamyeh/ansible:ubuntu14.04-onbuild
 #FROM williamyeh/ansible:debian7-onbuild
 #FROM williamyeh/ansible:centos7-onbuild
 #FROM williamyeh/ansible:centos6-onbuild
+#FROM williamyeh/ansible:alpine3-onbuild
 
 
 # ==> Specify requirements filename;  default = "requirements.yml"
index beac0fcfa970de96a4895543bd47d521c67709b4..46458fb665f59b220329120880b7ef65d55b663a 100644 (file)
@@ -10,6 +10,7 @@ Vagrant.configure(2) do |config|
     docker build  -t ansible:debian7              debian7
     docker build  -t ansible:centos7              centos7
     docker build  -t ansible:centos6              centos6
+    docker build  -t ansible:alpine3              alpine3
 
     docker build  -t ansible:ubuntu14.04-onbuild  ubuntu14.04-onbuild
     docker build  -t ansible:ubuntu12.04-onbuild  ubuntu12.04-onbuild
@@ -17,6 +18,7 @@ Vagrant.configure(2) do |config|
     docker build  -t ansible:debian7-onbuild      debian7-onbuild
     docker build  -t ansible:centos7-onbuild      centos7-onbuild
     docker build  -t ansible:centos6-onbuild      centos6-onbuild
+    docker build  -t ansible:alpine3-onbuild      alpine3-onbuild
 
   SHELL
 end
diff --git a/alpine3-onbuild/Dockerfile b/alpine3-onbuild/Dockerfile
new file mode 100644 (file)
index 0000000..41d6fab
--- /dev/null
@@ -0,0 +1,47 @@
+# Dockerfile for building Ansible image for Alpine 3, with as few additional software as possible.
+#
+# @see https://github.com/gliderlabs/docker-alpine/blob/master/docs/usage.md
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM alpine:3.2
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Adding Python runtime..."  && \
+    apk --update add python py-pip openssl ca-certificates               && \
+    apk --update add --virtual build-dependencies python-dev build-base  && \
+    pip install --upgrade pip                                            && \
+    \
+    \
+    echo "===> Installing Ansible..."  && \
+    pip install ansible                && \
+    \
+    \
+    echo "===> Removing package list..."  && \
+    apk del build-dependencies            && \
+    rm -rf /var/cache/apk/*               && \
+    \
+    \
+    echo "===> Adding hosts for convenience..."  && \
+    mkdir -p /etc/ansible                        && \
+    echo '[local]\nlocalhost\n' > /etc/ansible/hosts
+
+
+COPY ansible-playbook-wrapper /usr/local/bin/
+
+
+ONBUILD  WORKDIR  /tmp
+ONBUILD  COPY  .  /tmp
+ONBUILD  RUN  \
+              echo "===> Diagnosis: host information..."  && \
+              ansible -c local -m setup all
+
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
diff --git a/alpine3-onbuild/ansible-playbook-wrapper b/alpine3-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/alpine3/Dockerfile b/alpine3/Dockerfile
new file mode 100644 (file)
index 0000000..04efa90
--- /dev/null
@@ -0,0 +1,36 @@
+# Dockerfile for building Ansible image for Alpine 3, with as few additional software as possible.
+#
+# @see https://github.com/gliderlabs/docker-alpine/blob/master/docs/usage.md
+#
+# Version  1.0
+#
+
+
+# pull base image
+FROM alpine:3.2
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Adding Python runtime..."  && \
+    apk --update add python py-pip openssl ca-certificates               && \
+    apk --update add --virtual build-dependencies python-dev build-base  && \
+    pip install --upgrade pip                                            && \
+    \
+    \
+    echo "===> Installing Ansible..."  && \
+    pip install ansible                && \
+    \
+    \
+    echo "===> Removing package list..."  && \
+    apk del build-dependencies            && \
+    rm -rf /var/cache/apk/*               && \
+    \
+    \
+    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" ]
index 6d69d2fc7a1ed765dd75c1a88dba14429ed6d212..c979c1f151a23c16e9a3e6ecea4f21ee93008d95 100644 (file)
@@ -13,6 +13,7 @@ dependencies:
     - docker build  -t ansible_wheezy           debian7
     - docker build  -t ansible_centos7          centos7
     - docker build  -t ansible_centos6          centos6
+    - docker build  -t ansible_alpine3          alpine3
 
     - docker build  -t ansible_trusty_onbuild   ubuntu14.04-onbuild
     - docker build  -t ansible_precise_onbuild  ubuntu12.04-onbuild
@@ -20,6 +21,7 @@ dependencies:
     - docker build  -t ansible_wheezy_onbuild   debian7-onbuild
     - docker build  -t ansible_centos7_onbuild  centos7-onbuild
     - docker build  -t ansible_centos6_onbuild  centos6-onbuild
+    - docker build  -t ansible_alpine3_onbuild  alpine3-onbuild
 
 test:
   override:
@@ -29,12 +31,14 @@ test:
     - docker run -i ansible_wheezy           > result-debian7
     - docker run -i ansible_centos7          > result-centos7
     - docker run -i ansible_centos6          > result-centos6
+    - docker run -i ansible_alpine3          > result-alpine3
     - docker run -i ansible_trusty_onbuild   > result-ubuntu14.04-onbuild
     - docker run -i ansible_precise_onbuild  > result-ubuntu12.04-onbuild
     - docker run -i ansible_jessie_onbuild   > result-debian8-onbuild
     - docker run -i ansible_wheezy_onbuild   > result-debian7-onbuild
     - docker run -i ansible_centos7_onbuild  > result-centos7-onbuild
     - docker run -i ansible_centos6_onbuild  > result-centos6-onbuild
+    - docker run -i ansible_alpine3_onbuild  > result-alpine3-onbuild
 
     - echo "==> Validating the test results..."
     - sh -c "[ -s result-ubuntu14.04         ]"
@@ -43,9 +47,11 @@ test:
     - sh -c "[ -s result-debian7             ]"
     - sh -c "[ -s result-centos7             ]"
     - sh -c "[ -s result-centos6             ]"
+    - sh -c "[ -s result-alpine3             ]"
     - sh -c "[ -s result-ubuntu14.04-onbuild ]"
     - sh -c "[ -s result-ubuntu12.04-onbuild ]"
     - sh -c "[ -s result-debian8-onbuild     ]"
     - sh -c "[ -s result-debian7-onbuild     ]"
     - sh -c "[ -s result-centos7-onbuild     ]"
     - sh -c "[ -s result-centos6-onbuild     ]"
+    - sh -c "[ -s result-alpine3-onbuild     ]"