]> git.immae.eu Git - github/fretlink/docker-ansible.git/blobdiff - README.md
debian9: use "slim" version of debian image
[github/fretlink/docker-ansible.git] / README.md
index 7dce9f86d1058a6dfb3b146c92c07ba46c04b3fa..58627ac65bf929d4eec2e9acc8e4845b89b86b1c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,12 +1,14 @@
 Docker-Ansible base images
 ===================
 
+[![Circle CI](https://circleci.com/gh/William-Yeh/docker-ansible.svg?style=shield)](https://circleci.com/gh/William-Yeh/docker-ansible) [![Build Status](https://travis-ci.org/William-Yeh/docker-ansible.svg?branch=master)](https://travis-ci.org/William-Yeh/docker-ansible)
+
 
 ## Summary
 
-Repository name in Docker Hub: **[williamyeh/ansible](https://registry.hub.docker.com/u/williamyeh/ansible/)**
+Repository name in Docker Hub: **[williamyeh/ansible](https://hub.docker.com/r/williamyeh/ansible/)**
 
-This repository contains Dockerized [Ansible](https://github.com/ansible/ansible), published to the public [Docker Hub](https://registry.hub.docker.com/) via **automated build** mechanism.
+This repository contains Dockerized [Ansible](https://github.com/ansible/ansible), published to the public [Docker Hub](https://hub.docker.com/) via **automated build** mechanism.
 
 
 
@@ -14,31 +16,134 @@ 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).
+### Base OS
+
+Debian (stretch, jessie), Ubuntu (xenial, trusty), CentOS (7), Alpine (3).
+
+Supports for Wheezy, Precise, and CentOS6 have been ended since Sep 2017.
+
+### Ansible
+
+Four versions are provided:
+
+  1. provides the most recent *stable* version of Ansible; suitable for most people.
+  2. same as stable version, but is designed for building (near-)*minimal* images out of playbooks; i.e., the Ansible body will be removed when mission completed. Refer to “[Build Docker images with Ansible: A half-blood approach](https://github.com/William-Yeh/build-docker-with-ansible)” for working examples and slides.
+  3. provides the old 1.9 version of Ansible (but will be retired someday).
+  4. provides the *experimental* version of Ansible; i.e., the master branch of official [Ansible's git repo](https://github.com/ansible/ansible).
+
+Each version is further divided into two variants:
 
-- Ansible: usually the latest version.
+- *Normal* variant: intended to be used as Ansible *control machines*, or in cases that is inadequate in the onbuild variants.
+- *Onbuild* variant: intended to be used to build Docker images.
 
 
 ## Images and tags
 
-- normal series:
+### Stable version (installed from official PyPI repo):
 
+- Normal variants:
+
+  - `williamyeh/ansible:debian9`
   - `williamyeh/ansible:debian8`
-  - `williamyeh/ansible:debian7`
+  - `williamyeh/ansible:ubuntu16.04`
   - `williamyeh/ansible:ubuntu14.04`
-  - `williamyeh/ansible:ubuntu12.04`
+  - `williamyeh/ansible:centos7`
+  - `williamyeh/ansible:alpine3`
 
-- onbuild series:
+- Onbuild variants (*recommended for common cases*):
 
+  - `williamyeh/ansible:debian9-onbuild`
   - `williamyeh/ansible:debian8-onbuild`
-  - `williamyeh/ansible:debian7-onbuild`
+  - `williamyeh/ansible:ubuntu16.04-onbuild`
   - `williamyeh/ansible:ubuntu14.04-onbuild`
-  - `williamyeh/ansible:ubuntu12.04-onbuild`
+  - `williamyeh/ansible:centos7-onbuild`
+  - `williamyeh/ansible:alpine3-onbuild`
+
+
+### Minimal configuration (the Ansible body will be removed when mission completed):
+
+Refer to “[Build Docker images with Ansible: A half-blood approach](https://github.com/William-Yeh/build-docker-with-ansible)” for working examples and slides.
+
+- Onbuild variants:
+
+  - `williamyeh/ansible:mini-alpine3`
+  - `williamyeh/ansible:mini-debian9`
+  - `williamyeh/ansible:mini-debian8`
+
+
+### Old 1.9 version (will be retired someday):
+
+Note: Ansible 1.9 was not supported in CentOS EPEL since January 2017, according to [this announcement](http://www.spinics.net/linux/fedora/epel-devel/msg00792.html).
+
+- Normal variants:
+
+  - `williamyeh/ansible:1.9-debian8`
+  - `williamyeh/ansible:1.9-ubuntu14.04`
+  - `williamyeh/ansible:1.9-alpine3`
+
+- Onbuild variants (*recommended for common cases*):
+
+  - `williamyeh/ansible:1.9-debian8-onbuild`
+  - `williamyeh/ansible:1.9-ubuntu14.04-onbuild`
+  - `williamyeh/ansible:1.9-alpine3-onbuild`
+
+
+### Experimental version (building directly from the git `master` source tree; use at your own risk!):
+
+- Normal variants:
+
+  - `williamyeh/ansible:master-debian9`
+  - `williamyeh/ansible:master-debian8`
+  - `williamyeh/ansible:master-ubuntu16.04`
+  - `williamyeh/ansible:master-ubuntu14.04`
+  - `williamyeh/ansible:master-centos7`
+
+- 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`
+  - `williamyeh/ansible:master-centos7-onbuild`
+
+
+
+## For the impatient
+
+Here comes a simplest working example for the impatient.
+
+First, choose a base image you'd like to begin with. For example, `williamyeh/ansible:ubuntu14.04-onbuild`.
+
+Second, put the following `Dockerfile` along with your playbook directory:
+
+```
+FROM williamyeh/ansible:ubuntu14.04-onbuild
+
+# ==> Specify requirements filename;  default = "requirements.yml"
+#ENV REQUIREMENTS  requirements.yml
+
+# ==> Specify playbook filename;      default = "playbook.yml"
+#ENV PLAYBOOK      playbook.yml
+
+# ==> Specify inventory filename;     default = "/etc/ansible/hosts"
+#ENV INVENTORY     inventory.ini
+
+# ==> Executing Ansible (with a simple wrapper)...
+RUN ansible-playbook-wrapper
+```
+
+Third, `docker build .`
+
+Done!
+
+For more advanced usage, the role in Ansible Galaxy [`williamyeh/nginx`](https://galaxy.ansible.com/williamyeh/nginx/) demonstrates how to perform a simple smoke test (*configuration needs test, too!*) on a variety of (*containerized*) Linux distributions on [CircleCI](https://circleci.com/)'s Ubuntu 12.04 and [Travis CI](https://travis-ci.org/)’s Ubuntu 14.04 worker instances.
+
+
 
 
 ## Why yet another Ansible image for Docker?
 
-There has been quite a few Ansible images for Docker (e.g., [search](https://registry.hub.docker.com/search?q=ansible) in the Docker Hub), so why reinvent the wheel?
+There has been quite a few Ansible images for Docker (e.g., [search](https://hub.docker.com/search/?q=ansible&isAutomated=0&isOfficial=0&page=1&pullCount=1&starCount=0) in the Docker Hub), so why reinvent the wheel?
 
 In the beginning I used the [`ansible/ansible-docker-base`](https://github.com/ansible/ansible-docker-base) created by Ansible Inc. It worked well, but left some room for improvement:
 
@@ -48,12 +153,31 @@ In the beginning I used the [`ansible/ansible-docker-base`](https://github.com/a
 
 Therefore, I built these Docker images on my own.
 
+**NOTE:** [`ansible/ansible-docker-base`](https://github.com/ansible/ansible-docker-base) announced in September 2015: “Ansible no longer maintains images in Dockerhub directly.”
+
+### Comparison: image size
+
+```
+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
+williamyeh/ansible            debian8-onbuild       178.3 MB
+williamyeh/ansible            ubuntu12.04-onbuild   181.9 MB
+williamyeh/ansible            ubuntu14.04-onbuild   238.3 MB
+```
+
 
 ## Usage
 
-Used mostly as a *base image* for configuring, with Ansible, other software stack on some specified Linux distribution.
+Used mostly as a *base image* for configuring other software stack on some specified Linux distribution(s).
 
-Take Debian/Ubuntu for example. To test an Ansible `playbook.yml` against a variety of Linux distributions, we may use [Vagrant](https://www.vagrantup.com/) as follows:
+Take Debian/Ubuntu/CentOS for example. To test an Ansible `playbook.yml` against a variety of Linux distributions, we may use [Vagrant](https://www.vagrantup.com/) as follows:
 
 ```ruby
 # Vagrantfile
@@ -61,9 +185,13 @@ Take Debian/Ubuntu for example. To test an Ansible `playbook.yml` against a vari
 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 = "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"
+
 
     # ==> Executing Ansible...
     config.vm.provision "ansible" do |ansible|
@@ -83,10 +211,12 @@ Docker to be a rescue. Now, with these **williamyeh/ansible** series, we may tes
 # Dockerfile
 
 # ==> Choose a base image to emulate Linux distribution...
-FROM williamyeh/ansible:ubuntu14.04
-#FROM williamyeh/ansible:ubuntu12.04
+FROM williamyeh/ansible:ubuntu16.04
+#FROM williamyeh/ansible:ubuntu14.04
+#FROM williamyeh/ansible:debian9
 #FROM williamyeh/ansible:debian8
-#FROM williamyeh/ansible:debian7
+#FROM williamyeh/ansible:centos7
+#FROM williamyeh/ansible:alpine3
 
 
 # ==> Copying Ansible playbook...
@@ -101,25 +231,30 @@ RUN ansible-playbook -i inventory playbook.yml \
       --connection=local --sudo
 ```
 
-Or, more simple with `onbuild` series:
+You may also work with `onbuild` variants, which take care of many routine steps for you:
 
 ```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:ubuntu16.04-onbuild
+#FROM williamyeh/ansible:ubuntu14.04-onbuild
+#FROM williamyeh/ansible:debian9-onbuild
 #FROM williamyeh/ansible:debian8-onbuild
-#FROM williamyeh/ansible:debian7-onbuild
+#FROM williamyeh/ansible:centos7-onbuild
+#FROM williamyeh/ansible:alpine3-onbuild
 
 
-# ==> Specify playbook filename;   default = "playbook.yml"
-#ENV PLAYBOOK   playbook.yml
+# ==> Specify requirements filename;  default = "requirements.yml"
+#ENV REQUIREMENTS  requirements.yml
 
-# ==> Specify inventory filename;  default = "/etc/ansible/hosts"
-#ENV INVENTORY  inventory.ini
+# ==> Specify playbook filename;      default = "playbook.yml"
+#ENV PLAYBOOK      playbook.yml
 
-# ==> Executing Ansible...
+# ==> Specify inventory filename;     default = "/etc/ansible/hosts"
+#ENV INVENTORY     inventory.ini
+
+# ==> Executing Ansible (with a simple wrapper)...
 RUN ansible-playbook-wrapper
 ```