- docker build -t ansible_xenial ubuntu16.04
- docker build -t ansible_trusty ubuntu14.04
+ - docker build -t ansible_stretch debian9
- docker build -t ansible_jessie debian8
- docker build -t ansible_centos7 centos7
- docker build -t ansible_alpine3 alpine3
- docker build -t ansible_xenial_onbuild ubuntu16.04-onbuild
- docker build -t ansible_trusty_onbuild ubuntu14.04-onbuild
+ - docker build -t ansible_stretch_onbuild debian9-onbuild
- docker build -t ansible_jessie_onbuild debian8-onbuild
- docker build -t ansible_centos7_onbuild centos7-onbuild
- docker build -t ansible_alpine3_onbuild alpine3-onbuild
- docker build -t ansible_master_xenial master-ubuntu16.04
- docker build -t ansible_master_trusty master-ubuntu14.04
+ - docker build -t ansible_master_stretch master-debian9
- docker build -t ansible_master_jessie master-debian8
- docker build -t ansible_master_centos7 master-centos7
- docker build -t ansible_master_xenial_onbuild master-ubuntu16.04-onbuild
- docker build -t ansible_master_trusty_onbuild master-ubuntu14.04-onbuild
+ - docker build -t ansible_master_stretch_onbuild master-debian9-onbuild
- docker build -t ansible_master_jessie_onbuild master-debian8-onbuild
- docker build -t ansible_master_centos7_onbuild master-centos7-onbuild
- docker build -t ansible_mini_alpine3 mini-alpine3
+ - docker build -t ansible_mini_debian9 mini-debian9
- docker build -t ansible_mini_debian8 mini-debian8
- docker build -t nginx_alpine3 -f mini-test/Dockerfile.alpine3 mini-test
+ - docker build -t nginx_debian9 -f mini-test/Dockerfile.debian9 mini-test
- docker build -t nginx_debian8 -f mini-test/Dockerfile.debian8 mini-test
script:
- docker run -i ansible_xenial > result-ubuntu16.04
- docker run -i ansible_trusty > result-ubuntu14.04
+ - docker run -i ansible_stretch > result-debian9
- docker run -i ansible_jessie > result-debian8
- docker run -i ansible_centos7 > result-centos7
- docker run -i ansible_alpine3 > result-alpine3
- docker run -i ansible_xenial_onbuild > result-ubuntu16.04-onbuild
- docker run -i ansible_trusty_onbuild > result-ubuntu14.04-onbuild
+ - docker run -i ansible_stretch_onbuild > result-debian9-onbuild
- docker run -i ansible_jessie_onbuild > result-debian8-onbuild
- docker run -i ansible_centos7_onbuild > result-centos7-onbuild
- docker run -i ansible_alpine3_onbuild > result-alpine3-onbuild
- docker run -i ansible_master_xenial > result-master-ubuntu16.04
- docker run -i ansible_master_trusty > result-master-ubuntu14.04
+ - docker run -i ansible_master_stretch > result-master-debian9
- docker run -i ansible_master_jessie > result-master-debian8
- docker run -i ansible_master_centos7 > result-master-centos7
- docker run -i ansible_master_xenial_onbuild > result-master-ubuntu16.04-onbuild
- docker run -i ansible_master_trusty_onbuild > result-master-ubuntu14.04-onbuild
+ - docker run -i ansible_master_stretch_onbuild > result-master-debian9-onbuild
- docker run -i ansible_master_jessie_onbuild > result-master-debian8-onbuild
- docker run -i ansible_master_centos7_onbuild > result-master-centos7-onbuild
- docker run -i nginx_alpine3 2> result-nginx-alpine3
+ - docker run -i nginx_debian9 2> result-nginx-debian9
- docker run -i nginx_debian8 2> result-nginx-debian8
- echo "==> Validating the test results..."
- sh -c "[ -s result-ubuntu16.04 ]"
- sh -c "[ -s result-ubuntu14.04 ]"
+ - sh -c "[ -s result-debian9 ]"
- sh -c "[ -s result-debian8 ]"
- sh -c "[ -s result-centos7 ]"
- sh -c "[ -s result-alpine3 ]"
- sh -c "[ -s result-ubuntu16.04-onbuild ]"
- sh -c "[ -s result-ubuntu14.04-onbuild ]"
+ - sh -c "[ -s result-debian9-onbuild ]"
- sh -c "[ -s result-debian8-onbuild ]"
- sh -c "[ -s result-centos7-onbuild ]"
- sh -c "[ -s result-alpine3-onbuild ]"
- sh -c "[ -s result-master-ubuntu16.04 ]"
- sh -c "[ -s result-master-ubuntu14.04 ]"
+ - sh -c "[ -s result-master-debian9 ]"
- sh -c "[ -s result-master-debian8 ]"
- sh -c "[ -s result-master-centos7 ]"
- sh -c "[ -s result-master-ubuntu16.04-onbuild ]"
- sh -c "[ -s result-master-ubuntu14.04-onbuild ]"
+ - sh -c "[ -s result-master-debian9-onbuild ]"
- sh -c "[ -s result-master-debian8-onbuild ]"
- sh -c "[ -s result-master-centos7-onbuild ]"
- sh -c "[ -s result-nginx-alpine3 ]"
+ - sh -c "[ -s result-nginx-debian9 ]"
- sh -c "[ -s result-nginx-debian8 ]"
### Base OS
-Debian (jessie), Ubuntu (xenial, trusty), CentOS (7), Alpine (3).
+Debian (stretch, jessie), Ubuntu (xenial, trusty), CentOS (7), Alpine (3).
Supports for Wheezy, Precise, and CentOS6 have been ended since Sep 2017.
- Normal variants:
+ - `williamyeh/ansible:debian9`
- `williamyeh/ansible:debian8`
- `williamyeh/ansible:ubuntu16.04`
- `williamyeh/ansible:ubuntu14.04`
- Onbuild variants (*recommended for common cases*):
+ - `williamyeh/ansible:debian9-onbuild`
- `williamyeh/ansible:debian8-onbuild`
- `williamyeh/ansible:ubuntu16.04-onbuild`
- `williamyeh/ansible:ubuntu14.04-onbuild`
- Onbuild variants:
- `williamyeh/ansible:mini-alpine3`
+ - `williamyeh/ansible:mini-debian9`
- `williamyeh/ansible:mini-debian8`
- Normal variants:
+ - `williamyeh/ansible:master-debian9`
- `williamyeh/ansible:master-debian8`
- `williamyeh/ansible:master-ubuntu16.04`
- `williamyeh/ansible:master-ubuntu14.04`
- Onbuild variants (*recommended for common cases*):
+ - `williamyeh/ansible:master-debian9-onbuild`
- `williamyeh/ansible:master-debian8-onbuild`
- `williamyeh/ansible:master-ubuntu16.04-onbuild`
- `williamyeh/ansible:master-ubuntu14.04-onbuild`
Vagrant.configure(2) do |config|
# ==> Choose a Vagrant box to emulate Linux distribution...
- #config.vm.box = "ubuntu/xenial64"
- config.vm.box = "ubuntu/trusty64"
+ config.vm.box = "ubuntu/xenial64"
+ #config.vm.box = "ubuntu/trusty64"
+ #config.vm.box = "debian/stretch64"
#config.vm.box = "debian/jessie64"
#config.vm.box = "bento/centos-7.2"
#config.vm.box = "maier/alpine-3.3.1-x86_64"
# Dockerfile
# ==> Choose a base image to emulate Linux distribution...
-#FROM williamyeh/ansible:ubuntu16.04
-FROM williamyeh/ansible:ubuntu14.04
+FROM williamyeh/ansible:ubuntu16.04
+#FROM williamyeh/ansible:ubuntu14.04
+#FROM williamyeh/ansible:debian9
#FROM williamyeh/ansible:debian8
#FROM williamyeh/ansible:centos7
#FROM williamyeh/ansible:alpine3
# Dockerfile
# ==> Choose a base image to emulate Linux distribution...
-#FROM williamyeh/ansible:ubuntu16.04-onbuild
-FROM williamyeh/ansible:ubuntu14.04-onbuild
+FROM williamyeh/ansible:ubuntu16.04-onbuild
+#FROM williamyeh/ansible:ubuntu14.04-onbuild
+#FROM williamyeh/ansible:debian9-onbuild
#FROM williamyeh/ansible:debian8-onbuild
#FROM williamyeh/ansible:centos7-onbuild
#FROM williamyeh/ansible:alpine3-onbuild
docker build -t ansible:ubuntu16.04 ubuntu16.04
docker build -t ansible:ubuntu14.04 ubuntu14.04
+ docker build -t ansible:debian9 debian9
docker build -t ansible:debian8 debian8
docker build -t ansible:centos7 centos7
docker build -t ansible:alpine3 alpine3
docker build -t ansible:ubuntu16.04-onbuild ubuntu16.04-onbuild
docker build -t ansible:ubuntu14.04-onbuild ubuntu14.04-onbuild
+ docker build -t ansible:debian9-onbuild debian9-onbuild
docker build -t ansible:debian8-onbuild debian8-onbuild
docker build -t ansible:centos7-onbuild centos7-onbuild
docker build -t ansible:alpine3-onbuild alpine3-onbuild
- docker build -t ansible_xenial ubuntu16.04
- docker build -t ansible_trusty ubuntu14.04
+ - docker build -t ansible_stretch debian9
- docker build -t ansible_jessie debian8
- docker build -t ansible_centos7 centos7
- docker build -t ansible_alpine3 alpine3
- docker build -t ansible_xenial_onbuild ubuntu16.04-onbuild
- docker build -t ansible_trusty_onbuild ubuntu14.04-onbuild
+ - docker build -t ansible_stretch_onbuild debian9-onbuild
- docker build -t ansible_jessie_onbuild debian8-onbuild
- docker build -t ansible_centos7_onbuild centos7-onbuild
- docker build -t ansible_alpine3_onbuild alpine3-onbuild
- docker build -t ansible_master_xenial master-ubuntu16.04
- docker build -t ansible_master_trusty master-ubuntu14.04
+ - docker build -t ansible_master_stretch master-debian9
- docker build -t ansible_master_jessie master-debian8
- docker build -t ansible_master_centos7 master-centos7
- docker build -t ansible_master_xenial_onbuild master-ubuntu16.04-onbuild
- docker build -t ansible_master_trusty_onbuild master-ubuntu14.04-onbuild
+ - docker build -t ansible_master_stretch_onbuild master-debian9-onbuild
- docker build -t ansible_master_jessie_onbuild master-debian8-onbuild
- docker build -t ansible_master_centos7_onbuild master-centos7-onbuild
- docker build -t ansible_mini_alpine3 mini-alpine3
+ - docker build -t ansible_mini_debian9 mini-debian9
- docker build -t ansible_mini_debian8 mini-debian8
- docker build -t nginx_alpine3 -f mini-test/Dockerfile.alpine3 mini-test
+ - docker build -t nginx_debian9 -f mini-test/Dockerfile.debian9 mini-test
- docker build -t nginx_debian8 -f mini-test/Dockerfile.debian8 mini-test
override:
- docker run -i ansible_xenial > result-ubuntu16.04
- docker run -i ansible_trusty > result-ubuntu14.04
+ - docker run -i ansible_stretch > result-debian9
- docker run -i ansible_jessie > result-debian8
- docker run -i ansible_centos7 > result-centos7
- docker run -i ansible_alpine3 > result-alpine3
- docker run -i ansible_xenial_onbuild > result-ubuntu16.04-onbuild
- docker run -i ansible_trusty_onbuild > result-ubuntu14.04-onbuild
+ - docker run -i ansible_stretch_onbuild > result-debian9-onbuild
- docker run -i ansible_jessie_onbuild > result-debian8-onbuild
- docker run -i ansible_centos7_onbuild > result-centos7-onbuild
- docker run -i ansible_alpine3_onbuild > result-alpine3-onbuild
- docker run -i ansible_master_xenial > result-master-ubuntu16.04
- docker run -i ansible_master_trusty > result-master-ubuntu14.04
+ - docker run -i ansible_master_stretch > result-master-debian9
- docker run -i ansible_master_jessie > result-master-debian8
- docker run -i ansible_master_centos7 > result-master-centos7
- docker run -i ansible_master_xenial_onbuild > result-master-ubuntu16.04-onbuild
- docker run -i ansible_master_trusty_onbuild > result-master-ubuntu14.04-onbuild
+ - docker run -i ansible_master_stretch_onbuild > result-master-debian9-onbuild
- docker run -i ansible_master_jessie_onbuild > result-master-debian8-onbuild
- docker run -i ansible_master_centos7_onbuild > result-master-centos7-onbuild
- docker run -i nginx_alpine3 2> result-nginx-alpine3
+ - docker run -i nginx_debian9 2> result-nginx-debian9
- docker run -i nginx_debian8 2> result-nginx-debian8
- echo "==> Validating the test results..."
- sh -c "[ -s result-ubuntu16.04 ]"
- sh -c "[ -s result-ubuntu14.04 ]"
+ - sh -c "[ -s result-debian9 ]"
- sh -c "[ -s result-debian8 ]"
- sh -c "[ -s result-centos7 ]"
- sh -c "[ -s result-alpine3 ]"
- sh -c "[ -s result-ubuntu16.04-onbuild ]"
- sh -c "[ -s result-ubuntu14.04-onbuild ]"
+ - sh -c "[ -s result-debian9-onbuild ]"
- sh -c "[ -s result-debian8-onbuild ]"
- sh -c "[ -s result-centos7-onbuild ]"
- sh -c "[ -s result-alpine3-onbuild ]"
- sh -c "[ -s result-master-ubuntu16.04 ]"
- sh -c "[ -s result-master-ubuntu14.04 ]"
+ - sh -c "[ -s result-master-debian9 ]"
- sh -c "[ -s result-master-debian8 ]"
- sh -c "[ -s result-master-centos7 ]"
- sh -c "[ -s result-master-ubuntu16.04-onbuild ]"
- sh -c "[ -s result-master-ubuntu14.04-onbuild ]"
+ - sh -c "[ -s result-master-debian9-onbuild ]"
- sh -c "[ -s result-master-debian8-onbuild ]"
- sh -c "[ -s result-master-centos7-onbuild ]"
- sh -c "[ -s result-nginx-alpine3 ]"
+ - sh -c "[ -s result-nginx-debian9 ]"
- sh -c "[ -s result-nginx-debian8 ]"
--- /dev/null
+# Dockerfile for building Ansible image for Debian 9 (stretch), with as few additional software as possible.
+#
+# @see https://launchpad.net/~ansible/+archive/ubuntu/ansible
+#
+# Version 1.0
+#
+
+
+# pull base image
+FROM debian:stretch
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Installing python, sudo, and supporting tools..." && \
+ apt-get update -y && apt-get install --fix-missing && \
+ DEBIAN_FRONTEND=noninteractive \
+ apt-get install -y \
+ python python-yaml sudo \
+ curl gcc python-pip python-dev libffi-dev libssl-dev && \
+ apt-get -y --purge remove python-cffi && \
+ pip install --upgrade cffi && \
+ \
+ \
+ echo "===> Installing Ansible..." && \
+ pip install ansible && \
+ \
+ \
+ echo "===> Removing unused APT resources..." && \
+ apt-get -f -y --auto-remove remove \
+ gcc python-pip python-dev libffi-dev libssl-dev && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/* /tmp/* && \
+ \
+ \
+ echo "===> Adding hosts for convenience..." && \
+ mkdir -p /etc/ansible && \
+ echo 'localhost' > /etc/ansible/hosts
+
+
+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" ]
--- /dev/null
+#!/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
+ apt-get install -y git
+ 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
--- /dev/null
+# Dockerfile for building Ansible image for Debian 9 (stretch), with as few additional software as possible.
+#
+# @see https://launchpad.net/~ansible/+archive/ubuntu/ansible
+#
+# Version 1.0
+#
+
+
+# pull base image
+FROM debian:stretch
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Installing python, sudo, and supporting tools..." && \
+ apt-get update -y && apt-get install --fix-missing && \
+ DEBIAN_FRONTEND=noninteractive \
+ apt-get install -y \
+ python python-yaml sudo \
+ curl gcc python-pip python-dev libffi-dev libssl-dev && \
+ apt-get -y --purge remove python-cffi && \
+ pip install --upgrade cffi pywinrm && \
+ \
+ \
+ \
+ echo "===> Installing Ansible..." && \
+ pip install ansible && \
+ \
+ \
+ \
+ echo "===> Installing handy tools (not absolutely required)..." && \
+ apt-get install -y sshpass openssh-client && \
+ \
+ \
+ echo "===> Removing unused APT resources..." && \
+ apt-get -f -y --auto-remove remove \
+ gcc python-pip python-dev libffi-dev libssl-dev && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/* /tmp/* && \
+ \
+ \
+ echo "===> Adding hosts for convenience..." && \
+ mkdir -p /etc/ansible && \
+ echo 'localhost' > /etc/ansible/hosts
+
+
+# default command: display Ansible version
+CMD [ "ansible-playbook", "--version" ]
--- /dev/null
+# Dockerfile for building Ansible image from source for Debian 9 (stretch), 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:stretch
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Adding Ansible's prerequisites..." && \
+ apt-get update -y && apt-get install --fix-missing && \
+ DEBIAN_FRONTEND=noninteractive \
+ apt-get install --no-install-recommends -y -q \
+ build-essential ca-certificates \
+ python python-pip python-dev \
+ libffi-dev libssl-dev \
+ libxml2-dev libxslt1-dev zlib1g-dev \
+ git sudo curl && \
+ pip install --upgrade setuptools pip wheel && \
+ pip install --upgrade cffi && \
+ 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 libffi-dev libssl-dev && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/* && \
+ \
+ \
+ echo "===> Adding hosts for convenience..." && \
+ mkdir -p /etc/ansible && \
+ echo 'localhost' > /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" ]
--- /dev/null
+#!/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
+ apt-get install -y git
+ 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
--- /dev/null
+# Dockerfile for building Ansible image from source for Debian 9 (stretch), 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:stretch
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+
+RUN echo "===> Adding Ansible's prerequisites..." && \
+ apt-get update -y && apt-get install --fix-missing && \
+ DEBIAN_FRONTEND=noninteractive \
+ apt-get install --no-install-recommends -y -q \
+ build-essential ca-certificates \
+ python python-pip python-dev \
+ libffi-dev libssl-dev \
+ libxml2-dev libxslt1-dev zlib1g-dev \
+ git sudo curl && \
+ pip install --upgrade setuptools pip wheel && \
+ pip install --upgrade cffi pywinrm && \
+ 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 "===> Installing handy tools (not absolutely required)..." && \
+
+ apt-get install -y sshpass openssh-client && \
+ \
+ \
+ echo "===> Clean up..." && \
+ apt-get remove -y --auto-remove \
+ build-essential python-pip python-dev git libffi-dev libssl-dev && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/* && \
+ \
+ \
+ echo "===> Adding hosts for convenience..." && \
+ mkdir -p /etc/ansible && \
+ echo 'localhost' > /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" ]
#
+export DEBIAN_FRONTEND=noninteractive
+
+
echo "===> Adding backports..."
mkdir -p /etc/apt/sources.list.d/
--- /dev/null
+# Dockerfile for building Debian-based image, via Ansible playbooks.
+#
+# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source
+#
+# Version 1.0
+#
+
+
+# pull base image
+FROM debian:9
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+#ENV APT_LIST apt-list
+
+
+COPY . /tmp
+
+ONBUILD COPY . /tmp
+ONBUILD RUN \
+ cd /tmp && \
+ ./prepare-pkg-list.sh && \
+ ./install-ansible.sh && \
+ ./ansible-playbook-wrapper && \
+ ./uninstall-ansible.sh && \
+ cd / && \
+ rm -rf /tmp/*
\ No newline at end of file
--- /dev/null
+#!/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
--- /dev/null
+#
+# packages to be installed via APT;
+# lines beginning with "! " (an exclamation mark, followed by a space) will *not* be *uninstalled* afterwards.
+#
+
+
+# common
+#####sudo curl gcc
+
+# ssl
+#####openssl ca-certificates
+
+# python-runtime
+python
+#####python-pip python-yaml
+
+# build-dependencies
+#####python-dev libffi-dev libssl-dev
+
+# may be required by ansible-galaxy
+git
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+#
+# Simple wrapper for installing ansible
+#
+
+
+export DEBIAN_FRONTEND=noninteractive
+
+
+echo "===> Adding prerequisites..."
+
+apt-get update -y
+cat ___APT_INSTALL_LIST | \
+ while read ITEM; do
+ apt-get install -y $ITEM
+ done
+
+
+
+echo "===> Installing Ansible..."
+apt-get install -y ansible
+
+
+
+echo "===> Adding hosts for convenience..." && \
+mkdir -p /etc/ansible && \
+echo 'localhost' > /etc/ansible/hosts
--- /dev/null
+#!/bin/sh
+#
+# Prepare the list of packages to be installed/uninstalled.
+#
+# ENVIRONMENT VARIABLES:
+#
+# - APT_LIST: APT package list; default = "apt-list"
+#
+
+echo "===> Preparing APT package list..."
+
+if [ -z "$APT_LIST" ]; then
+ APT_LIST=apt-list
+fi
+
+if [ -f "$APT_LIST" ]; then
+
+ awk '/^#/ {next} \
+ { split($0,arrayA); \
+ for (i in arrayA) { \
+ if (arrayA[i] == "!") { continue; } \
+ print arrayA[i] \
+ } \
+ }' \
+ $APT_LIST > ___APT_INSTALL_LIST
+
+ awk '/^(#|!)/ {next} \
+ { split($0,arrayA); for (i in arrayA) print arrayA[i] }' \
+ $APT_LIST |
+ awk '{ L[n++] = $0 } \
+ END { while(n--) \
+ print L[n] }' \
+ > ___APT_UNINSTALL_LIST
+
+fi
+#cat ___APT_INSTALL_LIST
+#cat ___APT_UNINSTALL_LIST
--- /dev/null
+#!/bin/sh
+#
+# Simple wrapper for uninstall ansible and related stuff.
+#
+
+
+echo "===> Removing Ansible..."
+apt-get -f -y --auto-remove remove ansible
+
+echo "===> Removing APT packages..."
+cat ___APT_UNINSTALL_LIST | \
+ while read ITEM; do
+ apt-get -f -y --auto-remove remove $ITEM
+ done
+apt-get clean
+
+
+echo "===> Cleaning up package list..."
+rm -rf /etc/python /etc/python2.7
+rm -rf /etc/ansible /root/.ansible /root/.cache
+rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d /var/cache/* /var/log/*
--- /dev/null
+# Dockerfile for building (near-)minimal nginx under Debian9
+#
+
+
+# pull base image
+FROM ansible_mini_debian9
+
+MAINTAINER William Yeh <william.pjyeh@gmail.com>
+
+#ENV APK_LIST apk-list
+
+ENTRYPOINT ["/usr/sbin/nginx"]
+#CMD ["-g", "daemon off;"]
+CMD ["-v"]