diff options
author | William Yeh <william.pjyeh@gmail.com> | 2015-09-17 15:26:56 +0800 |
---|---|---|
committer | William Yeh <william.pjyeh@gmail.com> | 2015-09-17 15:26:56 +0800 |
commit | ae06b63dc27567ebe8b8fde7f32e268ae706182d (patch) | |
tree | 06253e09a08f3d9d148660eabb4d5fe05155be1d | |
parent | aa3cb4d5e3a74a02a65b4b350251085e47d5eea4 (diff) | |
download | docker-ansible-ae06b63dc27567ebe8b8fde7f32e268ae706182d.tar.gz docker-ansible-ae06b63dc27567ebe8b8fde7f32e268ae706182d.tar.zst docker-ansible-ae06b63dc27567ebe8b8fde7f32e268ae706182d.zip |
Add: support for Alpine 3
-rw-r--r-- | .travis.yml | 6 | ||||
-rw-r--r-- | README.md | 17 | ||||
-rw-r--r-- | Vagrantfile | 2 | ||||
-rw-r--r-- | alpine3-onbuild/Dockerfile | 47 | ||||
-rwxr-xr-x | alpine3-onbuild/ansible-playbook-wrapper | 49 | ||||
-rw-r--r-- | alpine3/Dockerfile | 36 | ||||
-rw-r--r-- | circle.yml | 6 |
7 files changed, 158 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml index ad12eaa..06a51ce 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -12,6 +12,7 @@ before_install: | |||
12 | - docker build -t ansible_wheezy debian7 | 12 | - docker build -t ansible_wheezy debian7 |
13 | - docker build -t ansible_centos7 centos7 | 13 | - docker build -t ansible_centos7 centos7 |
14 | - docker build -t ansible_centos6 centos6 | 14 | - docker build -t ansible_centos6 centos6 |
15 | - docker build -t ansible_alpine3 alpine3 | ||
15 | 16 | ||
16 | - docker build -t ansible_trusty_onbuild ubuntu14.04-onbuild | 17 | - docker build -t ansible_trusty_onbuild ubuntu14.04-onbuild |
17 | - docker build -t ansible_precise_onbuild ubuntu12.04-onbuild | 18 | - docker build -t ansible_precise_onbuild ubuntu12.04-onbuild |
@@ -19,6 +20,7 @@ before_install: | |||
19 | - docker build -t ansible_wheezy_onbuild debian7-onbuild | 20 | - docker build -t ansible_wheezy_onbuild debian7-onbuild |
20 | - docker build -t ansible_centos7_onbuild centos7-onbuild | 21 | - docker build -t ansible_centos7_onbuild centos7-onbuild |
21 | - docker build -t ansible_centos6_onbuild centos6-onbuild | 22 | - docker build -t ansible_centos6_onbuild centos6-onbuild |
23 | - docker build -t ansible_alpine3_onbuild alpine3-onbuild | ||
22 | 24 | ||
23 | script: | 25 | script: |
24 | - docker run -i ansible_trusty > result-ubuntu14.04 | 26 | - docker run -i ansible_trusty > result-ubuntu14.04 |
@@ -27,12 +29,14 @@ script: | |||
27 | - docker run -i ansible_wheezy > result-debian7 | 29 | - docker run -i ansible_wheezy > result-debian7 |
28 | - docker run -i ansible_centos7 > result-centos7 | 30 | - docker run -i ansible_centos7 > result-centos7 |
29 | - docker run -i ansible_centos6 > result-centos6 | 31 | - docker run -i ansible_centos6 > result-centos6 |
32 | - docker run -i ansible_alpine3 > result-alpine3 | ||
30 | - docker run -i ansible_trusty_onbuild > result-ubuntu14.04-onbuild | 33 | - docker run -i ansible_trusty_onbuild > result-ubuntu14.04-onbuild |
31 | - docker run -i ansible_precise_onbuild > result-ubuntu12.04-onbuild | 34 | - docker run -i ansible_precise_onbuild > result-ubuntu12.04-onbuild |
32 | - docker run -i ansible_jessie_onbuild > result-debian8-onbuild | 35 | - docker run -i ansible_jessie_onbuild > result-debian8-onbuild |
33 | - docker run -i ansible_wheezy_onbuild > result-debian7-onbuild | 36 | - docker run -i ansible_wheezy_onbuild > result-debian7-onbuild |
34 | - docker run -i ansible_centos7_onbuild > result-centos7-onbuild | 37 | - docker run -i ansible_centos7_onbuild > result-centos7-onbuild |
35 | - docker run -i ansible_centos6_onbuild > result-centos6-onbuild | 38 | - docker run -i ansible_centos6_onbuild > result-centos6-onbuild |
39 | - docker run -i ansible_alpine3_onbuild > result-alpine3-onbuild | ||
36 | 40 | ||
37 | - echo "==> Validating the test results..." | 41 | - echo "==> Validating the test results..." |
38 | - sh -c "[ -s result-ubuntu14.04 ]" | 42 | - sh -c "[ -s result-ubuntu14.04 ]" |
@@ -41,9 +45,11 @@ script: | |||
41 | - sh -c "[ -s result-debian7 ]" | 45 | - sh -c "[ -s result-debian7 ]" |
42 | - sh -c "[ -s result-centos7 ]" | 46 | - sh -c "[ -s result-centos7 ]" |
43 | - sh -c "[ -s result-centos6 ]" | 47 | - sh -c "[ -s result-centos6 ]" |
48 | - sh -c "[ -s result-alpine3 ]" | ||
44 | - sh -c "[ -s result-ubuntu14.04-onbuild ]" | 49 | - sh -c "[ -s result-ubuntu14.04-onbuild ]" |
45 | - sh -c "[ -s result-ubuntu12.04-onbuild ]" | 50 | - sh -c "[ -s result-ubuntu12.04-onbuild ]" |
46 | - sh -c "[ -s result-debian8-onbuild ]" | 51 | - sh -c "[ -s result-debian8-onbuild ]" |
47 | - sh -c "[ -s result-debian7-onbuild ]" | 52 | - sh -c "[ -s result-debian7-onbuild ]" |
48 | - sh -c "[ -s result-centos7-onbuild ]" | 53 | - sh -c "[ -s result-centos7-onbuild ]" |
49 | - sh -c "[ -s result-centos6-onbuild ]" | 54 | - sh -c "[ -s result-centos6-onbuild ]" |
55 | - sh -c "[ -s result-alpine3-onbuild ]" | ||
@@ -16,7 +16,7 @@ This repository contains Dockerized [Ansible](https://github.com/ansible/ansible | |||
16 | 16 | ||
17 | These are Docker images for [Ansible](https://github.com/ansible/ansible) software, installed in a selected Linux distributions. | 17 | These are Docker images for [Ansible](https://github.com/ansible/ansible) software, installed in a selected Linux distributions. |
18 | 18 | ||
19 | - OS: Debian (jessie, wheezy), Ubuntu (trusty, precise), CentOS (7, 6) | 19 | - OS: Debian (jessie, wheezy), Ubuntu (trusty, precise), CentOS (7, 6), Alpine (3). |
20 | 20 | ||
21 | - Ansible: usually the latest version (I didn't pin any specific version). | 21 | - Ansible: usually the latest version (I didn't pin any specific version). |
22 | 22 | ||
@@ -31,6 +31,7 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa | |||
31 | - `williamyeh/ansible:ubuntu12.04` | 31 | - `williamyeh/ansible:ubuntu12.04` |
32 | - `williamyeh/ansible:centos7` | 32 | - `williamyeh/ansible:centos7` |
33 | - `williamyeh/ansible:centos6` | 33 | - `williamyeh/ansible:centos6` |
34 | - `williamyeh/ansible:alpine3` | ||
34 | 35 | ||
35 | - Onbuild series: | 36 | - Onbuild series: |
36 | 37 | ||
@@ -40,6 +41,7 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa | |||
40 | - `williamyeh/ansible:ubuntu12.04-onbuild` | 41 | - `williamyeh/ansible:ubuntu12.04-onbuild` |
41 | - `williamyeh/ansible:centos7-onbuild` | 42 | - `williamyeh/ansible:centos7-onbuild` |
42 | - `williamyeh/ansible:centos6-onbuild` | 43 | - `williamyeh/ansible:centos6-onbuild` |
44 | - `williamyeh/ansible:alpine3-onbuild` | ||
43 | 45 | ||
44 | 46 | ||
45 | ## For the impatient | 47 | ## For the impatient |
@@ -97,6 +99,7 @@ REPOSITORY TAG VIRTUAL SIZE | |||
97 | ansible/centos7-ansible stable 367.5 MB | 99 | ansible/centos7-ansible stable 367.5 MB |
98 | ansible/ubuntu14.04-ansible stable 286.6 MB | 100 | ansible/ubuntu14.04-ansible stable 286.6 MB |
99 | 101 | ||
102 | williamyeh/ansible alpine3-onbuild 66.4 MB | ||
100 | williamyeh/ansible centos6-onbuild 264.2 MB | 103 | williamyeh/ansible centos6-onbuild 264.2 MB |
101 | williamyeh/ansible centos7-onbuild 275.3 MB | 104 | williamyeh/ansible centos7-onbuild 275.3 MB |
102 | williamyeh/ansible debian7-onbuild 134.4 MB | 105 | williamyeh/ansible debian7-onbuild 134.4 MB |
@@ -119,10 +122,12 @@ Vagrant.configure(2) do |config| | |||
119 | 122 | ||
120 | # ==> Choose a Vagrant box to emulate Linux distribution... | 123 | # ==> Choose a Vagrant box to emulate Linux distribution... |
121 | config.vm.box = "ubuntu/trusty64" | 124 | config.vm.box = "ubuntu/trusty64" |
122 | #config.vm.box = "hashicorp/precise64" | 125 | #config.vm.box = "ubuntu/precise64" |
123 | #config.vm.box = "chef/debian-7.8" | 126 | #config.vm.box = "debian/jessie64" |
124 | #config.vm.box = "chef/centos-7.0" | 127 | #config.vm.box = "debian/wheezy64" |
125 | #config.vm.box = "chef/centos-6.6" | 128 | #config.vm.box = "bento/centos-7.1" |
129 | #config.vm.box = "bento/centos-6.7" | ||
130 | #config.vm.box = "maier/alpine-3.1.3-x86_64" | ||
126 | 131 | ||
127 | 132 | ||
128 | # ==> Executing Ansible... | 133 | # ==> Executing Ansible... |
@@ -149,6 +154,7 @@ FROM williamyeh/ansible:ubuntu14.04 | |||
149 | #FROM williamyeh/ansible:debian7 | 154 | #FROM williamyeh/ansible:debian7 |
150 | #FROM williamyeh/ansible:centos7 | 155 | #FROM williamyeh/ansible:centos7 |
151 | #FROM williamyeh/ansible:centos6 | 156 | #FROM williamyeh/ansible:centos6 |
157 | #FROM williamyeh/ansible:alpine3 | ||
152 | 158 | ||
153 | 159 | ||
154 | # ==> Copying Ansible playbook... | 160 | # ==> Copying Ansible playbook... |
@@ -175,6 +181,7 @@ FROM williamyeh/ansible:ubuntu14.04-onbuild | |||
175 | #FROM williamyeh/ansible:debian7-onbuild | 181 | #FROM williamyeh/ansible:debian7-onbuild |
176 | #FROM williamyeh/ansible:centos7-onbuild | 182 | #FROM williamyeh/ansible:centos7-onbuild |
177 | #FROM williamyeh/ansible:centos6-onbuild | 183 | #FROM williamyeh/ansible:centos6-onbuild |
184 | #FROM williamyeh/ansible:alpine3-onbuild | ||
178 | 185 | ||
179 | 186 | ||
180 | # ==> Specify requirements filename; default = "requirements.yml" | 187 | # ==> Specify requirements filename; default = "requirements.yml" |
diff --git a/Vagrantfile b/Vagrantfile index beac0fc..46458fb 100644 --- a/Vagrantfile +++ b/Vagrantfile | |||
@@ -10,6 +10,7 @@ Vagrant.configure(2) do |config| | |||
10 | docker build -t ansible:debian7 debian7 | 10 | docker build -t ansible:debian7 debian7 |
11 | docker build -t ansible:centos7 centos7 | 11 | docker build -t ansible:centos7 centos7 |
12 | docker build -t ansible:centos6 centos6 | 12 | docker build -t ansible:centos6 centos6 |
13 | docker build -t ansible:alpine3 alpine3 | ||
13 | 14 | ||
14 | docker build -t ansible:ubuntu14.04-onbuild ubuntu14.04-onbuild | 15 | docker build -t ansible:ubuntu14.04-onbuild ubuntu14.04-onbuild |
15 | docker build -t ansible:ubuntu12.04-onbuild ubuntu12.04-onbuild | 16 | docker build -t ansible:ubuntu12.04-onbuild ubuntu12.04-onbuild |
@@ -17,6 +18,7 @@ Vagrant.configure(2) do |config| | |||
17 | docker build -t ansible:debian7-onbuild debian7-onbuild | 18 | docker build -t ansible:debian7-onbuild debian7-onbuild |
18 | docker build -t ansible:centos7-onbuild centos7-onbuild | 19 | docker build -t ansible:centos7-onbuild centos7-onbuild |
19 | docker build -t ansible:centos6-onbuild centos6-onbuild | 20 | docker build -t ansible:centos6-onbuild centos6-onbuild |
21 | docker build -t ansible:alpine3-onbuild alpine3-onbuild | ||
20 | 22 | ||
21 | SHELL | 23 | SHELL |
22 | end | 24 | end |
diff --git a/alpine3-onbuild/Dockerfile b/alpine3-onbuild/Dockerfile new file mode 100644 index 0000000..41d6fab --- /dev/null +++ b/alpine3-onbuild/Dockerfile | |||
@@ -0,0 +1,47 @@ | |||
1 | # Dockerfile for building Ansible image for Alpine 3, with as few additional software as possible. | ||
2 | # | ||
3 | # @see https://github.com/gliderlabs/docker-alpine/blob/master/docs/usage.md | ||
4 | # | ||
5 | # Version 1.0 | ||
6 | # | ||
7 | |||
8 | |||
9 | # pull base image | ||
10 | FROM alpine:3.2 | ||
11 | |||
12 | MAINTAINER William Yeh <william.pjyeh@gmail.com> | ||
13 | |||
14 | |||
15 | RUN echo "===> Adding Python runtime..." && \ | ||
16 | apk --update add python py-pip openssl ca-certificates && \ | ||
17 | apk --update add --virtual build-dependencies python-dev build-base && \ | ||
18 | pip install --upgrade pip && \ | ||
19 | \ | ||
20 | \ | ||
21 | echo "===> Installing Ansible..." && \ | ||
22 | pip install ansible && \ | ||
23 | \ | ||
24 | \ | ||
25 | echo "===> Removing package list..." && \ | ||
26 | apk del build-dependencies && \ | ||
27 | rm -rf /var/cache/apk/* && \ | ||
28 | \ | ||
29 | \ | ||
30 | echo "===> Adding hosts for convenience..." && \ | ||
31 | mkdir -p /etc/ansible && \ | ||
32 | echo '[local]\nlocalhost\n' > /etc/ansible/hosts | ||
33 | |||
34 | |||
35 | COPY ansible-playbook-wrapper /usr/local/bin/ | ||
36 | |||
37 | |||
38 | ONBUILD WORKDIR /tmp | ||
39 | ONBUILD COPY . /tmp | ||
40 | ONBUILD RUN \ | ||
41 | echo "===> Diagnosis: host information..." && \ | ||
42 | ansible -c local -m setup all | ||
43 | |||
44 | |||
45 | |||
46 | # default command: display Ansible version | ||
47 | CMD [ "ansible-playbook", "--version" ] | ||
diff --git a/alpine3-onbuild/ansible-playbook-wrapper b/alpine3-onbuild/ansible-playbook-wrapper new file mode 100755 index 0000000..0ba45e6 --- /dev/null +++ b/alpine3-onbuild/ansible-playbook-wrapper | |||
@@ -0,0 +1,49 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # Simple wrapper for executing ansible-galaxy and ansible-playbook | ||
4 | # with local connection. | ||
5 | # | ||
6 | # USAGE: | ||
7 | # ansible-playbook-wrapper [other ansible-playbook arguments] | ||
8 | # | ||
9 | # ENVIRONMENT VARIABLES: | ||
10 | # | ||
11 | # - REQUIREMENTS: requirements filename; default = "requirements.yml" | ||
12 | # - PLAYBOOK: playbook filename; default = "playbook.yml" | ||
13 | # - INVENTORY: inventory filename; default = "/etc/ansible/hosts" | ||
14 | # | ||
15 | |||
16 | |||
17 | # | ||
18 | # install Galaxy roles, if any | ||
19 | # | ||
20 | |||
21 | if [ -z "$REQUIREMENTS" ]; then | ||
22 | REQUIREMENTS=requirements.yml | ||
23 | fi | ||
24 | |||
25 | if [ -f "$REQUIREMENTS" ]; then | ||
26 | ansible-galaxy install -r $REQUIREMENTS | ||
27 | fi | ||
28 | |||
29 | |||
30 | # | ||
31 | # execute playbook | ||
32 | # | ||
33 | |||
34 | if [ -z "$PLAYBOOK" ]; then | ||
35 | PLAYBOOK=playbook.yml | ||
36 | fi | ||
37 | |||
38 | |||
39 | if [ -z "$INVENTORY" ]; then | ||
40 | exec ansible-playbook \ | ||
41 | $PLAYBOOK \ | ||
42 | --connection=local \ | ||
43 | "$@" | ||
44 | else | ||
45 | exec ansible-playbook \ | ||
46 | -i $INVENTORY $PLAYBOOK \ | ||
47 | --connection=local \ | ||
48 | "$@" | ||
49 | fi | ||
diff --git a/alpine3/Dockerfile b/alpine3/Dockerfile new file mode 100644 index 0000000..04efa90 --- /dev/null +++ b/alpine3/Dockerfile | |||
@@ -0,0 +1,36 @@ | |||
1 | # Dockerfile for building Ansible image for Alpine 3, with as few additional software as possible. | ||
2 | # | ||
3 | # @see https://github.com/gliderlabs/docker-alpine/blob/master/docs/usage.md | ||
4 | # | ||
5 | # Version 1.0 | ||
6 | # | ||
7 | |||
8 | |||
9 | # pull base image | ||
10 | FROM alpine:3.2 | ||
11 | |||
12 | MAINTAINER William Yeh <william.pjyeh@gmail.com> | ||
13 | |||
14 | |||
15 | RUN echo "===> Adding Python runtime..." && \ | ||
16 | apk --update add python py-pip openssl ca-certificates && \ | ||
17 | apk --update add --virtual build-dependencies python-dev build-base && \ | ||
18 | pip install --upgrade pip && \ | ||
19 | \ | ||
20 | \ | ||
21 | echo "===> Installing Ansible..." && \ | ||
22 | pip install ansible && \ | ||
23 | \ | ||
24 | \ | ||
25 | echo "===> Removing package list..." && \ | ||
26 | apk del build-dependencies && \ | ||
27 | rm -rf /var/cache/apk/* && \ | ||
28 | \ | ||
29 | \ | ||
30 | echo "===> Adding hosts for convenience..." && \ | ||
31 | mkdir -p /etc/ansible && \ | ||
32 | echo '[local]\nlocalhost\n' > /etc/ansible/hosts | ||
33 | |||
34 | |||
35 | # default command: display Ansible version | ||
36 | CMD [ "ansible-playbook", "--version" ] | ||
@@ -13,6 +13,7 @@ dependencies: | |||
13 | - docker build -t ansible_wheezy debian7 | 13 | - docker build -t ansible_wheezy debian7 |
14 | - docker build -t ansible_centos7 centos7 | 14 | - docker build -t ansible_centos7 centos7 |
15 | - docker build -t ansible_centos6 centos6 | 15 | - docker build -t ansible_centos6 centos6 |
16 | - docker build -t ansible_alpine3 alpine3 | ||
16 | 17 | ||
17 | - docker build -t ansible_trusty_onbuild ubuntu14.04-onbuild | 18 | - docker build -t ansible_trusty_onbuild ubuntu14.04-onbuild |
18 | - docker build -t ansible_precise_onbuild ubuntu12.04-onbuild | 19 | - docker build -t ansible_precise_onbuild ubuntu12.04-onbuild |
@@ -20,6 +21,7 @@ dependencies: | |||
20 | - docker build -t ansible_wheezy_onbuild debian7-onbuild | 21 | - docker build -t ansible_wheezy_onbuild debian7-onbuild |
21 | - docker build -t ansible_centos7_onbuild centos7-onbuild | 22 | - docker build -t ansible_centos7_onbuild centos7-onbuild |
22 | - docker build -t ansible_centos6_onbuild centos6-onbuild | 23 | - docker build -t ansible_centos6_onbuild centos6-onbuild |
24 | - docker build -t ansible_alpine3_onbuild alpine3-onbuild | ||
23 | 25 | ||
24 | test: | 26 | test: |
25 | override: | 27 | override: |
@@ -29,12 +31,14 @@ test: | |||
29 | - docker run -i ansible_wheezy > result-debian7 | 31 | - docker run -i ansible_wheezy > result-debian7 |
30 | - docker run -i ansible_centos7 > result-centos7 | 32 | - docker run -i ansible_centos7 > result-centos7 |
31 | - docker run -i ansible_centos6 > result-centos6 | 33 | - docker run -i ansible_centos6 > result-centos6 |
34 | - docker run -i ansible_alpine3 > result-alpine3 | ||
32 | - docker run -i ansible_trusty_onbuild > result-ubuntu14.04-onbuild | 35 | - docker run -i ansible_trusty_onbuild > result-ubuntu14.04-onbuild |
33 | - docker run -i ansible_precise_onbuild > result-ubuntu12.04-onbuild | 36 | - docker run -i ansible_precise_onbuild > result-ubuntu12.04-onbuild |
34 | - docker run -i ansible_jessie_onbuild > result-debian8-onbuild | 37 | - docker run -i ansible_jessie_onbuild > result-debian8-onbuild |
35 | - docker run -i ansible_wheezy_onbuild > result-debian7-onbuild | 38 | - docker run -i ansible_wheezy_onbuild > result-debian7-onbuild |
36 | - docker run -i ansible_centos7_onbuild > result-centos7-onbuild | 39 | - docker run -i ansible_centos7_onbuild > result-centos7-onbuild |
37 | - docker run -i ansible_centos6_onbuild > result-centos6-onbuild | 40 | - docker run -i ansible_centos6_onbuild > result-centos6-onbuild |
41 | - docker run -i ansible_alpine3_onbuild > result-alpine3-onbuild | ||
38 | 42 | ||
39 | - echo "==> Validating the test results..." | 43 | - echo "==> Validating the test results..." |
40 | - sh -c "[ -s result-ubuntu14.04 ]" | 44 | - sh -c "[ -s result-ubuntu14.04 ]" |
@@ -43,9 +47,11 @@ test: | |||
43 | - sh -c "[ -s result-debian7 ]" | 47 | - sh -c "[ -s result-debian7 ]" |
44 | - sh -c "[ -s result-centos7 ]" | 48 | - sh -c "[ -s result-centos7 ]" |
45 | - sh -c "[ -s result-centos6 ]" | 49 | - sh -c "[ -s result-centos6 ]" |
50 | - sh -c "[ -s result-alpine3 ]" | ||
46 | - sh -c "[ -s result-ubuntu14.04-onbuild ]" | 51 | - sh -c "[ -s result-ubuntu14.04-onbuild ]" |
47 | - sh -c "[ -s result-ubuntu12.04-onbuild ]" | 52 | - sh -c "[ -s result-ubuntu12.04-onbuild ]" |
48 | - sh -c "[ -s result-debian8-onbuild ]" | 53 | - sh -c "[ -s result-debian8-onbuild ]" |
49 | - sh -c "[ -s result-debian7-onbuild ]" | 54 | - sh -c "[ -s result-debian7-onbuild ]" |
50 | - sh -c "[ -s result-centos7-onbuild ]" | 55 | - sh -c "[ -s result-centos7-onbuild ]" |
51 | - sh -c "[ -s result-centos6-onbuild ]" | 56 | - sh -c "[ -s result-centos6-onbuild ]" |
57 | - sh -c "[ -s result-alpine3-onbuild ]" | ||