aboutsummaryrefslogtreecommitdiffhomepage
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md93
1 files changed, 93 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e648f67
--- /dev/null
+++ b/README.md
@@ -0,0 +1,93 @@
1Docker-Ansible base images
2===================
3
4
5## Summary
6
7Repository name in Docker Hub: **[williamyeh/ansible]((https://registry.hub.docker.com/u/williamyeh/ansible/)**
8
9This repository contains Dockerized [Ansible](https://github.com/ansible/ansible), published to the public [Docker Hub](https://registry.hub.docker.com/) via **automated build** mechanism.
10
11
12
13## Configuration
14
15These are Docker images for [Ansible](https://github.com/ansible/ansible) software, installed in a selected Linux distributions.
16
17- OS: Debian (wheezy), Ubuntu (precise, trusty).
18
19- Ansible: usually the latest version.
20
21
22
23## Why yet another Ansible image for Docker?
24
25There 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?
26
27In 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:
28
29- *Base OS image* - It provides only `centos:centos7` and `ubuntu:14.04`. Insufficent for me.
30
31- *Unnecessary dependencies* - It installed, at the very beginning of its Dockerfile, the `software-properties-common` package, which in turns installed some Python packages. I prefered to incorporate these stuff only when absolutely needed.
32
33Therefore, I built these Docker images on my own.
34
35
36## Usage
37
38Used mostly as a *base image* for configuring, with Ansible, other software stack on some specified Linux distribution.
39
40Take 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:
41
42```ruby
43# Vagrantfile
44
45Vagrant.configure(2) do |config|
46
47 # ==> Choose a Vagrant box to emulate Linux distribution...
48 config.vm.box = "ubuntu/trusty64"
49 #config.vm.box = "hashicorp/precise64"
50 #config.vm.box = "chef/debian-7.8"
51
52 # ==> Executing Ansible...
53 config.vm.provision "ansible" do |ansible|
54 ansible.playbook = "playbook.yml"
55 end
56
57end
58```
59
60Virtual machines can emulate a variety of Linux distributions, at the cost of runtime overhead.
61
62Docker 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:
63
64
65```dockerfile
66# Dockerfile
67
68# ==> Choose a base image to emulate Linux distribution...
69FROM williamyeh/ansible:ubuntu14.04
70#FROM williamyeh/ansible:ubuntu12.04
71#FROM williamyeh/ansible:debian7
72
73# ==> Copying Ansible playbook...
74WORKDIR /tmp
75COPY . /tmp
76
77# ==> Creating inventory file...
78RUN echo localhost > inventory
79
80# ==> Executing Ansible...
81RUN ansible-playbook -i inventory playbook.yml \
82 --connection=local --sudo
83```
84
85With 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!
86
87
88
89## License
90
91Author: William Yeh <william.pjyeh@gmail.com>
92
93Licensed under the Apache License V2.0. See the [LICENSE file](LICENSE) for details.