diff options
-rw-r--r-- | .travis.yml | 16 | ||||
-rw-r--r-- | README.md | 22 | ||||
-rw-r--r-- | Vagrantfile | 2 | ||||
-rw-r--r-- | circle.yml | 16 | ||||
-rw-r--r-- | debian9-onbuild/Dockerfile | 56 | ||||
-rwxr-xr-x | debian9-onbuild/ansible-playbook-wrapper | 50 | ||||
-rw-r--r-- | debian9/Dockerfile | 48 | ||||
-rw-r--r-- | master-debian9-onbuild/Dockerfile | 78 | ||||
-rwxr-xr-x | master-debian9-onbuild/ansible-playbook-wrapper | 50 | ||||
-rw-r--r-- | master-debian9/Dockerfile | 69 | ||||
-rwxr-xr-x | mini-debian8/install-ansible.sh | 3 | ||||
-rw-r--r-- | mini-debian9/Dockerfile | 27 | ||||
-rwxr-xr-x | mini-debian9/ansible-playbook-wrapper | 49 | ||||
-rw-r--r-- | mini-debian9/apt-list | 21 | ||||
-rwxr-xr-x | mini-debian9/install-ansible.sh | 27 | ||||
-rwxr-xr-x | mini-debian9/prepare-pkg-list.sh | 37 | ||||
-rwxr-xr-x | mini-debian9/uninstall-ansible.sh | 21 | ||||
-rw-r--r-- | mini-test/Dockerfile.debian9 | 14 |
18 files changed, 599 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml index 7d2af6d..0e29db1 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -8,12 +8,14 @@ before_install: | |||
8 | 8 | ||
9 | - docker build -t ansible_xenial ubuntu16.04 | 9 | - docker build -t ansible_xenial ubuntu16.04 |
10 | - docker build -t ansible_trusty ubuntu14.04 | 10 | - docker build -t ansible_trusty ubuntu14.04 |
11 | - docker build -t ansible_stretch debian9 | ||
11 | - docker build -t ansible_jessie debian8 | 12 | - docker build -t ansible_jessie debian8 |
12 | - docker build -t ansible_centos7 centos7 | 13 | - docker build -t ansible_centos7 centos7 |
13 | - docker build -t ansible_alpine3 alpine3 | 14 | - docker build -t ansible_alpine3 alpine3 |
14 | 15 | ||
15 | - docker build -t ansible_xenial_onbuild ubuntu16.04-onbuild | 16 | - docker build -t ansible_xenial_onbuild ubuntu16.04-onbuild |
16 | - docker build -t ansible_trusty_onbuild ubuntu14.04-onbuild | 17 | - docker build -t ansible_trusty_onbuild ubuntu14.04-onbuild |
18 | - docker build -t ansible_stretch_onbuild debian9-onbuild | ||
17 | - docker build -t ansible_jessie_onbuild debian8-onbuild | 19 | - docker build -t ansible_jessie_onbuild debian8-onbuild |
18 | - docker build -t ansible_centos7_onbuild centos7-onbuild | 20 | - docker build -t ansible_centos7_onbuild centos7-onbuild |
19 | - docker build -t ansible_alpine3_onbuild alpine3-onbuild | 21 | - docker build -t ansible_alpine3_onbuild alpine3-onbuild |
@@ -30,29 +32,35 @@ before_install: | |||
30 | 32 | ||
31 | - docker build -t ansible_master_xenial master-ubuntu16.04 | 33 | - docker build -t ansible_master_xenial master-ubuntu16.04 |
32 | - docker build -t ansible_master_trusty master-ubuntu14.04 | 34 | - docker build -t ansible_master_trusty master-ubuntu14.04 |
35 | - docker build -t ansible_master_stretch master-debian9 | ||
33 | - docker build -t ansible_master_jessie master-debian8 | 36 | - docker build -t ansible_master_jessie master-debian8 |
34 | - docker build -t ansible_master_centos7 master-centos7 | 37 | - docker build -t ansible_master_centos7 master-centos7 |
35 | 38 | ||
36 | - docker build -t ansible_master_xenial_onbuild master-ubuntu16.04-onbuild | 39 | - docker build -t ansible_master_xenial_onbuild master-ubuntu16.04-onbuild |
37 | - docker build -t ansible_master_trusty_onbuild master-ubuntu14.04-onbuild | 40 | - docker build -t ansible_master_trusty_onbuild master-ubuntu14.04-onbuild |
41 | - docker build -t ansible_master_stretch_onbuild master-debian9-onbuild | ||
38 | - docker build -t ansible_master_jessie_onbuild master-debian8-onbuild | 42 | - docker build -t ansible_master_jessie_onbuild master-debian8-onbuild |
39 | - docker build -t ansible_master_centos7_onbuild master-centos7-onbuild | 43 | - docker build -t ansible_master_centos7_onbuild master-centos7-onbuild |
40 | 44 | ||
41 | 45 | ||
42 | - docker build -t ansible_mini_alpine3 mini-alpine3 | 46 | - docker build -t ansible_mini_alpine3 mini-alpine3 |
47 | - docker build -t ansible_mini_debian9 mini-debian9 | ||
43 | - docker build -t ansible_mini_debian8 mini-debian8 | 48 | - docker build -t ansible_mini_debian8 mini-debian8 |
44 | - docker build -t nginx_alpine3 -f mini-test/Dockerfile.alpine3 mini-test | 49 | - docker build -t nginx_alpine3 -f mini-test/Dockerfile.alpine3 mini-test |
50 | - docker build -t nginx_debian9 -f mini-test/Dockerfile.debian9 mini-test | ||
45 | - docker build -t nginx_debian8 -f mini-test/Dockerfile.debian8 mini-test | 51 | - docker build -t nginx_debian8 -f mini-test/Dockerfile.debian8 mini-test |
46 | 52 | ||
47 | 53 | ||
48 | script: | 54 | script: |
49 | - docker run -i ansible_xenial > result-ubuntu16.04 | 55 | - docker run -i ansible_xenial > result-ubuntu16.04 |
50 | - docker run -i ansible_trusty > result-ubuntu14.04 | 56 | - docker run -i ansible_trusty > result-ubuntu14.04 |
57 | - docker run -i ansible_stretch > result-debian9 | ||
51 | - docker run -i ansible_jessie > result-debian8 | 58 | - docker run -i ansible_jessie > result-debian8 |
52 | - docker run -i ansible_centos7 > result-centos7 | 59 | - docker run -i ansible_centos7 > result-centos7 |
53 | - docker run -i ansible_alpine3 > result-alpine3 | 60 | - docker run -i ansible_alpine3 > result-alpine3 |
54 | - docker run -i ansible_xenial_onbuild > result-ubuntu16.04-onbuild | 61 | - docker run -i ansible_xenial_onbuild > result-ubuntu16.04-onbuild |
55 | - docker run -i ansible_trusty_onbuild > result-ubuntu14.04-onbuild | 62 | - docker run -i ansible_trusty_onbuild > result-ubuntu14.04-onbuild |
63 | - docker run -i ansible_stretch_onbuild > result-debian9-onbuild | ||
56 | - docker run -i ansible_jessie_onbuild > result-debian8-onbuild | 64 | - docker run -i ansible_jessie_onbuild > result-debian8-onbuild |
57 | - docker run -i ansible_centos7_onbuild > result-centos7-onbuild | 65 | - docker run -i ansible_centos7_onbuild > result-centos7-onbuild |
58 | - docker run -i ansible_alpine3_onbuild > result-alpine3-onbuild | 66 | - docker run -i ansible_alpine3_onbuild > result-alpine3-onbuild |
@@ -68,26 +76,31 @@ script: | |||
68 | 76 | ||
69 | - docker run -i ansible_master_xenial > result-master-ubuntu16.04 | 77 | - docker run -i ansible_master_xenial > result-master-ubuntu16.04 |
70 | - docker run -i ansible_master_trusty > result-master-ubuntu14.04 | 78 | - docker run -i ansible_master_trusty > result-master-ubuntu14.04 |
79 | - docker run -i ansible_master_stretch > result-master-debian9 | ||
71 | - docker run -i ansible_master_jessie > result-master-debian8 | 80 | - docker run -i ansible_master_jessie > result-master-debian8 |
72 | - docker run -i ansible_master_centos7 > result-master-centos7 | 81 | - docker run -i ansible_master_centos7 > result-master-centos7 |
73 | - docker run -i ansible_master_xenial_onbuild > result-master-ubuntu16.04-onbuild | 82 | - docker run -i ansible_master_xenial_onbuild > result-master-ubuntu16.04-onbuild |
74 | - docker run -i ansible_master_trusty_onbuild > result-master-ubuntu14.04-onbuild | 83 | - docker run -i ansible_master_trusty_onbuild > result-master-ubuntu14.04-onbuild |
84 | - docker run -i ansible_master_stretch_onbuild > result-master-debian9-onbuild | ||
75 | - docker run -i ansible_master_jessie_onbuild > result-master-debian8-onbuild | 85 | - docker run -i ansible_master_jessie_onbuild > result-master-debian8-onbuild |
76 | - docker run -i ansible_master_centos7_onbuild > result-master-centos7-onbuild | 86 | - docker run -i ansible_master_centos7_onbuild > result-master-centos7-onbuild |
77 | 87 | ||
78 | 88 | ||
79 | - docker run -i nginx_alpine3 2> result-nginx-alpine3 | 89 | - docker run -i nginx_alpine3 2> result-nginx-alpine3 |
90 | - docker run -i nginx_debian9 2> result-nginx-debian9 | ||
80 | - docker run -i nginx_debian8 2> result-nginx-debian8 | 91 | - docker run -i nginx_debian8 2> result-nginx-debian8 |
81 | 92 | ||
82 | 93 | ||
83 | - echo "==> Validating the test results..." | 94 | - echo "==> Validating the test results..." |
84 | - sh -c "[ -s result-ubuntu16.04 ]" | 95 | - sh -c "[ -s result-ubuntu16.04 ]" |
85 | - sh -c "[ -s result-ubuntu14.04 ]" | 96 | - sh -c "[ -s result-ubuntu14.04 ]" |
97 | - sh -c "[ -s result-debian9 ]" | ||
86 | - sh -c "[ -s result-debian8 ]" | 98 | - sh -c "[ -s result-debian8 ]" |
87 | - sh -c "[ -s result-centos7 ]" | 99 | - sh -c "[ -s result-centos7 ]" |
88 | - sh -c "[ -s result-alpine3 ]" | 100 | - sh -c "[ -s result-alpine3 ]" |
89 | - sh -c "[ -s result-ubuntu16.04-onbuild ]" | 101 | - sh -c "[ -s result-ubuntu16.04-onbuild ]" |
90 | - sh -c "[ -s result-ubuntu14.04-onbuild ]" | 102 | - sh -c "[ -s result-ubuntu14.04-onbuild ]" |
103 | - sh -c "[ -s result-debian9-onbuild ]" | ||
91 | - sh -c "[ -s result-debian8-onbuild ]" | 104 | - sh -c "[ -s result-debian8-onbuild ]" |
92 | - sh -c "[ -s result-centos7-onbuild ]" | 105 | - sh -c "[ -s result-centos7-onbuild ]" |
93 | - sh -c "[ -s result-alpine3-onbuild ]" | 106 | - sh -c "[ -s result-alpine3-onbuild ]" |
@@ -101,12 +114,15 @@ script: | |||
101 | 114 | ||
102 | - sh -c "[ -s result-master-ubuntu16.04 ]" | 115 | - sh -c "[ -s result-master-ubuntu16.04 ]" |
103 | - sh -c "[ -s result-master-ubuntu14.04 ]" | 116 | - sh -c "[ -s result-master-ubuntu14.04 ]" |
117 | - sh -c "[ -s result-master-debian9 ]" | ||
104 | - sh -c "[ -s result-master-debian8 ]" | 118 | - sh -c "[ -s result-master-debian8 ]" |
105 | - sh -c "[ -s result-master-centos7 ]" | 119 | - sh -c "[ -s result-master-centos7 ]" |
106 | - sh -c "[ -s result-master-ubuntu16.04-onbuild ]" | 120 | - sh -c "[ -s result-master-ubuntu16.04-onbuild ]" |
107 | - sh -c "[ -s result-master-ubuntu14.04-onbuild ]" | 121 | - sh -c "[ -s result-master-ubuntu14.04-onbuild ]" |
122 | - sh -c "[ -s result-master-debian9-onbuild ]" | ||
108 | - sh -c "[ -s result-master-debian8-onbuild ]" | 123 | - sh -c "[ -s result-master-debian8-onbuild ]" |
109 | - sh -c "[ -s result-master-centos7-onbuild ]" | 124 | - sh -c "[ -s result-master-centos7-onbuild ]" |
110 | 125 | ||
111 | - sh -c "[ -s result-nginx-alpine3 ]" | 126 | - sh -c "[ -s result-nginx-alpine3 ]" |
127 | - sh -c "[ -s result-nginx-debian9 ]" | ||
112 | - sh -c "[ -s result-nginx-debian8 ]" | 128 | - sh -c "[ -s result-nginx-debian8 ]" |
@@ -18,7 +18,7 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa | |||
18 | 18 | ||
19 | ### Base OS | 19 | ### Base OS |
20 | 20 | ||
21 | Debian (jessie), Ubuntu (xenial, trusty), CentOS (7), Alpine (3). | 21 | Debian (stretch, jessie), Ubuntu (xenial, trusty), CentOS (7), Alpine (3). |
22 | 22 | ||
23 | Supports for Wheezy, Precise, and CentOS6 have been ended since Sep 2017. | 23 | Supports for Wheezy, Precise, and CentOS6 have been ended since Sep 2017. |
24 | 24 | ||
@@ -43,6 +43,7 @@ Each version is further divided into two variants: | |||
43 | 43 | ||
44 | - Normal variants: | 44 | - Normal variants: |
45 | 45 | ||
46 | - `williamyeh/ansible:debian9` | ||
46 | - `williamyeh/ansible:debian8` | 47 | - `williamyeh/ansible:debian8` |
47 | - `williamyeh/ansible:ubuntu16.04` | 48 | - `williamyeh/ansible:ubuntu16.04` |
48 | - `williamyeh/ansible:ubuntu14.04` | 49 | - `williamyeh/ansible:ubuntu14.04` |
@@ -51,6 +52,7 @@ Each version is further divided into two variants: | |||
51 | 52 | ||
52 | - Onbuild variants (*recommended for common cases*): | 53 | - Onbuild variants (*recommended for common cases*): |
53 | 54 | ||
55 | - `williamyeh/ansible:debian9-onbuild` | ||
54 | - `williamyeh/ansible:debian8-onbuild` | 56 | - `williamyeh/ansible:debian8-onbuild` |
55 | - `williamyeh/ansible:ubuntu16.04-onbuild` | 57 | - `williamyeh/ansible:ubuntu16.04-onbuild` |
56 | - `williamyeh/ansible:ubuntu14.04-onbuild` | 58 | - `williamyeh/ansible:ubuntu14.04-onbuild` |
@@ -65,6 +67,7 @@ Refer to “[Build Docker images with Ansible: A half-blood approach](https://gi | |||
65 | - Onbuild variants: | 67 | - Onbuild variants: |
66 | 68 | ||
67 | - `williamyeh/ansible:mini-alpine3` | 69 | - `williamyeh/ansible:mini-alpine3` |
70 | - `williamyeh/ansible:mini-debian9` | ||
68 | - `williamyeh/ansible:mini-debian8` | 71 | - `williamyeh/ansible:mini-debian8` |
69 | 72 | ||
70 | 73 | ||
@@ -89,6 +92,7 @@ Note: Ansible 1.9 was not supported in CentOS EPEL since January 2017, according | |||
89 | 92 | ||
90 | - Normal variants: | 93 | - Normal variants: |
91 | 94 | ||
95 | - `williamyeh/ansible:master-debian9` | ||
92 | - `williamyeh/ansible:master-debian8` | 96 | - `williamyeh/ansible:master-debian8` |
93 | - `williamyeh/ansible:master-ubuntu16.04` | 97 | - `williamyeh/ansible:master-ubuntu16.04` |
94 | - `williamyeh/ansible:master-ubuntu14.04` | 98 | - `williamyeh/ansible:master-ubuntu14.04` |
@@ -96,6 +100,7 @@ Note: Ansible 1.9 was not supported in CentOS EPEL since January 2017, according | |||
96 | 100 | ||
97 | - Onbuild variants (*recommended for common cases*): | 101 | - Onbuild variants (*recommended for common cases*): |
98 | 102 | ||
103 | - `williamyeh/ansible:master-debian9-onbuild` | ||
99 | - `williamyeh/ansible:master-debian8-onbuild` | 104 | - `williamyeh/ansible:master-debian8-onbuild` |
100 | - `williamyeh/ansible:master-ubuntu16.04-onbuild` | 105 | - `williamyeh/ansible:master-ubuntu16.04-onbuild` |
101 | - `williamyeh/ansible:master-ubuntu14.04-onbuild` | 106 | - `williamyeh/ansible:master-ubuntu14.04-onbuild` |
@@ -180,8 +185,9 @@ Take Debian/Ubuntu/CentOS for example. To test an Ansible `playbook.yml` against | |||
180 | Vagrant.configure(2) do |config| | 185 | Vagrant.configure(2) do |config| |
181 | 186 | ||
182 | # ==> Choose a Vagrant box to emulate Linux distribution... | 187 | # ==> Choose a Vagrant box to emulate Linux distribution... |
183 | #config.vm.box = "ubuntu/xenial64" | 188 | config.vm.box = "ubuntu/xenial64" |
184 | config.vm.box = "ubuntu/trusty64" | 189 | #config.vm.box = "ubuntu/trusty64" |
190 | #config.vm.box = "debian/stretch64" | ||
185 | #config.vm.box = "debian/jessie64" | 191 | #config.vm.box = "debian/jessie64" |
186 | #config.vm.box = "bento/centos-7.2" | 192 | #config.vm.box = "bento/centos-7.2" |
187 | #config.vm.box = "maier/alpine-3.3.1-x86_64" | 193 | #config.vm.box = "maier/alpine-3.3.1-x86_64" |
@@ -205,8 +211,9 @@ Docker to be a rescue. Now, with these **williamyeh/ansible** series, we may tes | |||
205 | # Dockerfile | 211 | # Dockerfile |
206 | 212 | ||
207 | # ==> Choose a base image to emulate Linux distribution... | 213 | # ==> Choose a base image to emulate Linux distribution... |
208 | #FROM williamyeh/ansible:ubuntu16.04 | 214 | FROM williamyeh/ansible:ubuntu16.04 |
209 | FROM williamyeh/ansible:ubuntu14.04 | 215 | #FROM williamyeh/ansible:ubuntu14.04 |
216 | #FROM williamyeh/ansible:debian9 | ||
210 | #FROM williamyeh/ansible:debian8 | 217 | #FROM williamyeh/ansible:debian8 |
211 | #FROM williamyeh/ansible:centos7 | 218 | #FROM williamyeh/ansible:centos7 |
212 | #FROM williamyeh/ansible:alpine3 | 219 | #FROM williamyeh/ansible:alpine3 |
@@ -230,8 +237,9 @@ You may also work with `onbuild` variants, which take care of many routine steps | |||
230 | # Dockerfile | 237 | # Dockerfile |
231 | 238 | ||
232 | # ==> Choose a base image to emulate Linux distribution... | 239 | # ==> Choose a base image to emulate Linux distribution... |
233 | #FROM williamyeh/ansible:ubuntu16.04-onbuild | 240 | FROM williamyeh/ansible:ubuntu16.04-onbuild |
234 | FROM williamyeh/ansible:ubuntu14.04-onbuild | 241 | #FROM williamyeh/ansible:ubuntu14.04-onbuild |
242 | #FROM williamyeh/ansible:debian9-onbuild | ||
235 | #FROM williamyeh/ansible:debian8-onbuild | 243 | #FROM williamyeh/ansible:debian8-onbuild |
236 | #FROM williamyeh/ansible:centos7-onbuild | 244 | #FROM williamyeh/ansible:centos7-onbuild |
237 | #FROM williamyeh/ansible:alpine3-onbuild | 245 | #FROM williamyeh/ansible:alpine3-onbuild |
diff --git a/Vagrantfile b/Vagrantfile index 2e1a5e9..14e558e 100644 --- a/Vagrantfile +++ b/Vagrantfile | |||
@@ -6,12 +6,14 @@ Vagrant.configure(2) do |config| | |||
6 | 6 | ||
7 | docker build -t ansible:ubuntu16.04 ubuntu16.04 | 7 | docker build -t ansible:ubuntu16.04 ubuntu16.04 |
8 | docker build -t ansible:ubuntu14.04 ubuntu14.04 | 8 | docker build -t ansible:ubuntu14.04 ubuntu14.04 |
9 | docker build -t ansible:debian9 debian9 | ||
9 | docker build -t ansible:debian8 debian8 | 10 | docker build -t ansible:debian8 debian8 |
10 | docker build -t ansible:centos7 centos7 | 11 | docker build -t ansible:centos7 centos7 |
11 | docker build -t ansible:alpine3 alpine3 | 12 | docker build -t ansible:alpine3 alpine3 |
12 | 13 | ||
13 | docker build -t ansible:ubuntu16.04-onbuild ubuntu16.04-onbuild | 14 | docker build -t ansible:ubuntu16.04-onbuild ubuntu16.04-onbuild |
14 | docker build -t ansible:ubuntu14.04-onbuild ubuntu14.04-onbuild | 15 | docker build -t ansible:ubuntu14.04-onbuild ubuntu14.04-onbuild |
16 | docker build -t ansible:debian9-onbuild debian9-onbuild | ||
15 | docker build -t ansible:debian8-onbuild debian8-onbuild | 17 | docker build -t ansible:debian8-onbuild debian8-onbuild |
16 | docker build -t ansible:centos7-onbuild centos7-onbuild | 18 | docker build -t ansible:centos7-onbuild centos7-onbuild |
17 | docker build -t ansible:alpine3-onbuild alpine3-onbuild | 19 | docker build -t ansible:alpine3-onbuild alpine3-onbuild |
@@ -9,12 +9,14 @@ dependencies: | |||
9 | 9 | ||
10 | - docker build -t ansible_xenial ubuntu16.04 | 10 | - docker build -t ansible_xenial ubuntu16.04 |
11 | - docker build -t ansible_trusty ubuntu14.04 | 11 | - docker build -t ansible_trusty ubuntu14.04 |
12 | - docker build -t ansible_stretch debian9 | ||
12 | - docker build -t ansible_jessie debian8 | 13 | - docker build -t ansible_jessie debian8 |
13 | - docker build -t ansible_centos7 centos7 | 14 | - docker build -t ansible_centos7 centos7 |
14 | - docker build -t ansible_alpine3 alpine3 | 15 | - docker build -t ansible_alpine3 alpine3 |
15 | 16 | ||
16 | - docker build -t ansible_xenial_onbuild ubuntu16.04-onbuild | 17 | - docker build -t ansible_xenial_onbuild ubuntu16.04-onbuild |
17 | - docker build -t ansible_trusty_onbuild ubuntu14.04-onbuild | 18 | - docker build -t ansible_trusty_onbuild ubuntu14.04-onbuild |
19 | - docker build -t ansible_stretch_onbuild debian9-onbuild | ||
18 | - docker build -t ansible_jessie_onbuild debian8-onbuild | 20 | - docker build -t ansible_jessie_onbuild debian8-onbuild |
19 | - docker build -t ansible_centos7_onbuild centos7-onbuild | 21 | - docker build -t ansible_centos7_onbuild centos7-onbuild |
20 | - docker build -t ansible_alpine3_onbuild alpine3-onbuild | 22 | - docker build -t ansible_alpine3_onbuild alpine3-onbuild |
@@ -31,18 +33,22 @@ dependencies: | |||
31 | 33 | ||
32 | - docker build -t ansible_master_xenial master-ubuntu16.04 | 34 | - docker build -t ansible_master_xenial master-ubuntu16.04 |
33 | - docker build -t ansible_master_trusty master-ubuntu14.04 | 35 | - docker build -t ansible_master_trusty master-ubuntu14.04 |
36 | - docker build -t ansible_master_stretch master-debian9 | ||
34 | - docker build -t ansible_master_jessie master-debian8 | 37 | - docker build -t ansible_master_jessie master-debian8 |
35 | - docker build -t ansible_master_centos7 master-centos7 | 38 | - docker build -t ansible_master_centos7 master-centos7 |
36 | 39 | ||
37 | - docker build -t ansible_master_xenial_onbuild master-ubuntu16.04-onbuild | 40 | - docker build -t ansible_master_xenial_onbuild master-ubuntu16.04-onbuild |
38 | - docker build -t ansible_master_trusty_onbuild master-ubuntu14.04-onbuild | 41 | - docker build -t ansible_master_trusty_onbuild master-ubuntu14.04-onbuild |
42 | - docker build -t ansible_master_stretch_onbuild master-debian9-onbuild | ||
39 | - docker build -t ansible_master_jessie_onbuild master-debian8-onbuild | 43 | - docker build -t ansible_master_jessie_onbuild master-debian8-onbuild |
40 | - docker build -t ansible_master_centos7_onbuild master-centos7-onbuild | 44 | - docker build -t ansible_master_centos7_onbuild master-centos7-onbuild |
41 | 45 | ||
42 | 46 | ||
43 | - docker build -t ansible_mini_alpine3 mini-alpine3 | 47 | - docker build -t ansible_mini_alpine3 mini-alpine3 |
48 | - docker build -t ansible_mini_debian9 mini-debian9 | ||
44 | - docker build -t ansible_mini_debian8 mini-debian8 | 49 | - docker build -t ansible_mini_debian8 mini-debian8 |
45 | - docker build -t nginx_alpine3 -f mini-test/Dockerfile.alpine3 mini-test | 50 | - docker build -t nginx_alpine3 -f mini-test/Dockerfile.alpine3 mini-test |
51 | - docker build -t nginx_debian9 -f mini-test/Dockerfile.debian9 mini-test | ||
46 | - docker build -t nginx_debian8 -f mini-test/Dockerfile.debian8 mini-test | 52 | - docker build -t nginx_debian8 -f mini-test/Dockerfile.debian8 mini-test |
47 | 53 | ||
48 | 54 | ||
@@ -50,11 +56,13 @@ test: | |||
50 | override: | 56 | override: |
51 | - docker run -i ansible_xenial > result-ubuntu16.04 | 57 | - docker run -i ansible_xenial > result-ubuntu16.04 |
52 | - docker run -i ansible_trusty > result-ubuntu14.04 | 58 | - docker run -i ansible_trusty > result-ubuntu14.04 |
59 | - docker run -i ansible_stretch > result-debian9 | ||
53 | - docker run -i ansible_jessie > result-debian8 | 60 | - docker run -i ansible_jessie > result-debian8 |
54 | - docker run -i ansible_centos7 > result-centos7 | 61 | - docker run -i ansible_centos7 > result-centos7 |
55 | - docker run -i ansible_alpine3 > result-alpine3 | 62 | - docker run -i ansible_alpine3 > result-alpine3 |
56 | - docker run -i ansible_xenial_onbuild > result-ubuntu16.04-onbuild | 63 | - docker run -i ansible_xenial_onbuild > result-ubuntu16.04-onbuild |
57 | - docker run -i ansible_trusty_onbuild > result-ubuntu14.04-onbuild | 64 | - docker run -i ansible_trusty_onbuild > result-ubuntu14.04-onbuild |
65 | - docker run -i ansible_stretch_onbuild > result-debian9-onbuild | ||
58 | - docker run -i ansible_jessie_onbuild > result-debian8-onbuild | 66 | - docker run -i ansible_jessie_onbuild > result-debian8-onbuild |
59 | - docker run -i ansible_centos7_onbuild > result-centos7-onbuild | 67 | - docker run -i ansible_centos7_onbuild > result-centos7-onbuild |
60 | - docker run -i ansible_alpine3_onbuild > result-alpine3-onbuild | 68 | - docker run -i ansible_alpine3_onbuild > result-alpine3-onbuild |
@@ -70,26 +78,31 @@ test: | |||
70 | 78 | ||
71 | - docker run -i ansible_master_xenial > result-master-ubuntu16.04 | 79 | - docker run -i ansible_master_xenial > result-master-ubuntu16.04 |
72 | - docker run -i ansible_master_trusty > result-master-ubuntu14.04 | 80 | - docker run -i ansible_master_trusty > result-master-ubuntu14.04 |
81 | - docker run -i ansible_master_stretch > result-master-debian9 | ||
73 | - docker run -i ansible_master_jessie > result-master-debian8 | 82 | - docker run -i ansible_master_jessie > result-master-debian8 |
74 | - docker run -i ansible_master_centos7 > result-master-centos7 | 83 | - docker run -i ansible_master_centos7 > result-master-centos7 |
75 | - docker run -i ansible_master_xenial_onbuild > result-master-ubuntu16.04-onbuild | 84 | - docker run -i ansible_master_xenial_onbuild > result-master-ubuntu16.04-onbuild |
76 | - docker run -i ansible_master_trusty_onbuild > result-master-ubuntu14.04-onbuild | 85 | - docker run -i ansible_master_trusty_onbuild > result-master-ubuntu14.04-onbuild |
86 | - docker run -i ansible_master_stretch_onbuild > result-master-debian9-onbuild | ||
77 | - docker run -i ansible_master_jessie_onbuild > result-master-debian8-onbuild | 87 | - docker run -i ansible_master_jessie_onbuild > result-master-debian8-onbuild |
78 | - docker run -i ansible_master_centos7_onbuild > result-master-centos7-onbuild | 88 | - docker run -i ansible_master_centos7_onbuild > result-master-centos7-onbuild |
79 | 89 | ||
80 | 90 | ||
81 | - docker run -i nginx_alpine3 2> result-nginx-alpine3 | 91 | - docker run -i nginx_alpine3 2> result-nginx-alpine3 |
92 | - docker run -i nginx_debian9 2> result-nginx-debian9 | ||
82 | - docker run -i nginx_debian8 2> result-nginx-debian8 | 93 | - docker run -i nginx_debian8 2> result-nginx-debian8 |
83 | 94 | ||
84 | 95 | ||
85 | - echo "==> Validating the test results..." | 96 | - echo "==> Validating the test results..." |
86 | - sh -c "[ -s result-ubuntu16.04 ]" | 97 | - sh -c "[ -s result-ubuntu16.04 ]" |
87 | - sh -c "[ -s result-ubuntu14.04 ]" | 98 | - sh -c "[ -s result-ubuntu14.04 ]" |
99 | - sh -c "[ -s result-debian9 ]" | ||
88 | - sh -c "[ -s result-debian8 ]" | 100 | - sh -c "[ -s result-debian8 ]" |
89 | - sh -c "[ -s result-centos7 ]" | 101 | - sh -c "[ -s result-centos7 ]" |
90 | - sh -c "[ -s result-alpine3 ]" | 102 | - sh -c "[ -s result-alpine3 ]" |
91 | - sh -c "[ -s result-ubuntu16.04-onbuild ]" | 103 | - sh -c "[ -s result-ubuntu16.04-onbuild ]" |
92 | - sh -c "[ -s result-ubuntu14.04-onbuild ]" | 104 | - sh -c "[ -s result-ubuntu14.04-onbuild ]" |
105 | - sh -c "[ -s result-debian9-onbuild ]" | ||
93 | - sh -c "[ -s result-debian8-onbuild ]" | 106 | - sh -c "[ -s result-debian8-onbuild ]" |
94 | - sh -c "[ -s result-centos7-onbuild ]" | 107 | - sh -c "[ -s result-centos7-onbuild ]" |
95 | - sh -c "[ -s result-alpine3-onbuild ]" | 108 | - sh -c "[ -s result-alpine3-onbuild ]" |
@@ -103,12 +116,15 @@ test: | |||
103 | 116 | ||
104 | - sh -c "[ -s result-master-ubuntu16.04 ]" | 117 | - sh -c "[ -s result-master-ubuntu16.04 ]" |
105 | - sh -c "[ -s result-master-ubuntu14.04 ]" | 118 | - sh -c "[ -s result-master-ubuntu14.04 ]" |
119 | - sh -c "[ -s result-master-debian9 ]" | ||
106 | - sh -c "[ -s result-master-debian8 ]" | 120 | - sh -c "[ -s result-master-debian8 ]" |
107 | - sh -c "[ -s result-master-centos7 ]" | 121 | - sh -c "[ -s result-master-centos7 ]" |
108 | - sh -c "[ -s result-master-ubuntu16.04-onbuild ]" | 122 | - sh -c "[ -s result-master-ubuntu16.04-onbuild ]" |
109 | - sh -c "[ -s result-master-ubuntu14.04-onbuild ]" | 123 | - sh -c "[ -s result-master-ubuntu14.04-onbuild ]" |
124 | - sh -c "[ -s result-master-debian9-onbuild ]" | ||
110 | - sh -c "[ -s result-master-debian8-onbuild ]" | 125 | - sh -c "[ -s result-master-debian8-onbuild ]" |
111 | - sh -c "[ -s result-master-centos7-onbuild ]" | 126 | - sh -c "[ -s result-master-centos7-onbuild ]" |
112 | 127 | ||
113 | - sh -c "[ -s result-nginx-alpine3 ]" | 128 | - sh -c "[ -s result-nginx-alpine3 ]" |
129 | - sh -c "[ -s result-nginx-debian9 ]" | ||
114 | - sh -c "[ -s result-nginx-debian8 ]" | 130 | - sh -c "[ -s result-nginx-debian8 ]" |
diff --git a/debian9-onbuild/Dockerfile b/debian9-onbuild/Dockerfile new file mode 100644 index 0000000..079ebd9 --- /dev/null +++ b/debian9-onbuild/Dockerfile | |||
@@ -0,0 +1,56 @@ | |||
1 | # Dockerfile for building Ansible image for Debian 9 (stretch), with as few additional software as possible. | ||
2 | # | ||
3 | # @see https://launchpad.net/~ansible/+archive/ubuntu/ansible | ||
4 | # | ||
5 | # Version 1.0 | ||
6 | # | ||
7 | |||
8 | |||
9 | # pull base image | ||
10 | FROM debian:stretch | ||
11 | |||
12 | MAINTAINER William Yeh <william.pjyeh@gmail.com> | ||
13 | |||
14 | |||
15 | RUN echo "===> Installing python, sudo, and supporting tools..." && \ | ||
16 | apt-get update -y && apt-get install --fix-missing && \ | ||
17 | DEBIAN_FRONTEND=noninteractive \ | ||
18 | apt-get install -y \ | ||
19 | python python-yaml sudo \ | ||
20 | curl gcc python-pip python-dev libffi-dev libssl-dev && \ | ||
21 | apt-get -y --purge remove python-cffi && \ | ||
22 | pip install --upgrade cffi && \ | ||
23 | \ | ||
24 | \ | ||
25 | echo "===> Installing Ansible..." && \ | ||
26 | pip install ansible && \ | ||
27 | \ | ||
28 | \ | ||
29 | echo "===> Removing unused APT resources..." && \ | ||
30 | apt-get -f -y --auto-remove remove \ | ||
31 | gcc python-pip python-dev libffi-dev libssl-dev && \ | ||
32 | apt-get clean && \ | ||
33 | rm -rf /var/lib/apt/lists/* /tmp/* && \ | ||
34 | \ | ||
35 | \ | ||
36 | echo "===> Adding hosts for convenience..." && \ | ||
37 | mkdir -p /etc/ansible && \ | ||
38 | echo 'localhost' > /etc/ansible/hosts | ||
39 | |||
40 | |||
41 | COPY ansible-playbook-wrapper /usr/local/bin/ | ||
42 | |||
43 | ONBUILD RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ | ||
44 | echo "===> Updating TLS certificates..." && \ | ||
45 | apt-get install -y openssl ca-certificates | ||
46 | |||
47 | ONBUILD WORKDIR /tmp | ||
48 | ONBUILD COPY . /tmp | ||
49 | ONBUILD RUN \ | ||
50 | echo "===> Diagnosis: host information..." && \ | ||
51 | ansible -c local -m setup all | ||
52 | |||
53 | |||
54 | |||
55 | # default command: display Ansible version | ||
56 | CMD [ "ansible-playbook", "--version" ] | ||
diff --git a/debian9-onbuild/ansible-playbook-wrapper b/debian9-onbuild/ansible-playbook-wrapper new file mode 100755 index 0000000..afe4d97 --- /dev/null +++ b/debian9-onbuild/ansible-playbook-wrapper | |||
@@ -0,0 +1,50 @@ | |||
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 | apt-get install -y git | ||
27 | ansible-galaxy install -r $REQUIREMENTS | ||
28 | fi | ||
29 | |||
30 | |||
31 | # | ||
32 | # execute playbook | ||
33 | # | ||
34 | |||
35 | if [ -z "$PLAYBOOK" ]; then | ||
36 | PLAYBOOK=playbook.yml | ||
37 | fi | ||
38 | |||
39 | |||
40 | if [ -z "$INVENTORY" ]; then | ||
41 | exec ansible-playbook \ | ||
42 | $PLAYBOOK \ | ||
43 | --connection=local \ | ||
44 | "$@" | ||
45 | else | ||
46 | exec ansible-playbook \ | ||
47 | -i $INVENTORY $PLAYBOOK \ | ||
48 | --connection=local \ | ||
49 | "$@" | ||
50 | fi | ||
diff --git a/debian9/Dockerfile b/debian9/Dockerfile new file mode 100644 index 0000000..c6e16a5 --- /dev/null +++ b/debian9/Dockerfile | |||
@@ -0,0 +1,48 @@ | |||
1 | # Dockerfile for building Ansible image for Debian 9 (stretch), with as few additional software as possible. | ||
2 | # | ||
3 | # @see https://launchpad.net/~ansible/+archive/ubuntu/ansible | ||
4 | # | ||
5 | # Version 1.0 | ||
6 | # | ||
7 | |||
8 | |||
9 | # pull base image | ||
10 | FROM debian:stretch | ||
11 | |||
12 | MAINTAINER William Yeh <william.pjyeh@gmail.com> | ||
13 | |||
14 | |||
15 | RUN echo "===> Installing python, sudo, and supporting tools..." && \ | ||
16 | apt-get update -y && apt-get install --fix-missing && \ | ||
17 | DEBIAN_FRONTEND=noninteractive \ | ||
18 | apt-get install -y \ | ||
19 | python python-yaml sudo \ | ||
20 | curl gcc python-pip python-dev libffi-dev libssl-dev && \ | ||
21 | apt-get -y --purge remove python-cffi && \ | ||
22 | pip install --upgrade cffi pywinrm && \ | ||
23 | \ | ||
24 | \ | ||
25 | \ | ||
26 | echo "===> Installing Ansible..." && \ | ||
27 | pip install ansible && \ | ||
28 | \ | ||
29 | \ | ||
30 | \ | ||
31 | echo "===> Installing handy tools (not absolutely required)..." && \ | ||
32 | apt-get install -y sshpass openssh-client && \ | ||
33 | \ | ||
34 | \ | ||
35 | echo "===> Removing unused APT resources..." && \ | ||
36 | apt-get -f -y --auto-remove remove \ | ||
37 | gcc python-pip python-dev libffi-dev libssl-dev && \ | ||
38 | apt-get clean && \ | ||
39 | rm -rf /var/lib/apt/lists/* /tmp/* && \ | ||
40 | \ | ||
41 | \ | ||
42 | echo "===> Adding hosts for convenience..." && \ | ||
43 | mkdir -p /etc/ansible && \ | ||
44 | echo 'localhost' > /etc/ansible/hosts | ||
45 | |||
46 | |||
47 | # default command: display Ansible version | ||
48 | CMD [ "ansible-playbook", "--version" ] | ||
diff --git a/master-debian9-onbuild/Dockerfile b/master-debian9-onbuild/Dockerfile new file mode 100644 index 0000000..dafbdf3 --- /dev/null +++ b/master-debian9-onbuild/Dockerfile | |||
@@ -0,0 +1,78 @@ | |||
1 | # Dockerfile for building Ansible image from source for Debian 9 (stretch), with as few additional software as possible. | ||
2 | # | ||
3 | # @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source | ||
4 | # | ||
5 | # Version 1.0 | ||
6 | # | ||
7 | |||
8 | |||
9 | # pull base image | ||
10 | FROM debian:stretch | ||
11 | |||
12 | MAINTAINER William Yeh <william.pjyeh@gmail.com> | ||
13 | |||
14 | |||
15 | RUN echo "===> Adding Ansible's prerequisites..." && \ | ||
16 | apt-get update -y && apt-get install --fix-missing && \ | ||
17 | DEBIAN_FRONTEND=noninteractive \ | ||
18 | apt-get install --no-install-recommends -y -q \ | ||
19 | build-essential ca-certificates \ | ||
20 | python python-pip python-dev \ | ||
21 | libffi-dev libssl-dev \ | ||
22 | libxml2-dev libxslt1-dev zlib1g-dev \ | ||
23 | git sudo curl && \ | ||
24 | pip install --upgrade setuptools pip wheel && \ | ||
25 | pip install --upgrade cffi && \ | ||
26 | pip install --upgrade pyyaml jinja2 pycrypto && \ | ||
27 | \ | ||
28 | \ | ||
29 | echo "===> Downloading Ansible's source tree..." && \ | ||
30 | git clone git://github.com/ansible/ansible.git --recursive && \ | ||
31 | \ | ||
32 | \ | ||
33 | echo "===> Compiling Ansible..." && \ | ||
34 | cd ansible && \ | ||
35 | bash -c 'source ./hacking/env-setup' && \ | ||
36 | \ | ||
37 | \ | ||
38 | echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \ | ||
39 | mkdir -p /opt/ansible && \ | ||
40 | mv /ansible/bin /opt/ansible/bin && \ | ||
41 | mv /ansible/lib /opt/ansible/lib && \ | ||
42 | mv /ansible/docs /opt/ansible/docs && \ | ||
43 | rm -rf /ansible && \ | ||
44 | \ | ||
45 | \ | ||
46 | echo "===> Clean up..." && \ | ||
47 | apt-get remove -y --auto-remove \ | ||
48 | build-essential python-pip python-dev git libffi-dev libssl-dev && \ | ||
49 | apt-get clean && \ | ||
50 | rm -rf /var/lib/apt/lists/* && \ | ||
51 | \ | ||
52 | \ | ||
53 | echo "===> Adding hosts for convenience..." && \ | ||
54 | mkdir -p /etc/ansible && \ | ||
55 | echo 'localhost' > /etc/ansible/hosts | ||
56 | |||
57 | |||
58 | ENV PATH /opt/ansible/bin:$PATH | ||
59 | ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH | ||
60 | ENV MANPATH /opt/ansible/docs/man:$MANPATH | ||
61 | |||
62 | |||
63 | COPY ansible-playbook-wrapper /usr/local/bin/ | ||
64 | |||
65 | ONBUILD RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ | ||
66 | echo "===> Updating TLS certificates..." && \ | ||
67 | apt-get install -y openssl ca-certificates | ||
68 | |||
69 | ONBUILD WORKDIR /tmp | ||
70 | ONBUILD COPY . /tmp | ||
71 | ONBUILD RUN \ | ||
72 | echo "===> Diagnosis: host information..." && \ | ||
73 | ansible -c local -m setup all | ||
74 | |||
75 | |||
76 | |||
77 | # default command: display Ansible version | ||
78 | CMD [ "ansible-playbook", "--version" ] | ||
diff --git a/master-debian9-onbuild/ansible-playbook-wrapper b/master-debian9-onbuild/ansible-playbook-wrapper new file mode 100755 index 0000000..afe4d97 --- /dev/null +++ b/master-debian9-onbuild/ansible-playbook-wrapper | |||
@@ -0,0 +1,50 @@ | |||
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 | apt-get install -y git | ||
27 | ansible-galaxy install -r $REQUIREMENTS | ||
28 | fi | ||
29 | |||
30 | |||
31 | # | ||
32 | # execute playbook | ||
33 | # | ||
34 | |||
35 | if [ -z "$PLAYBOOK" ]; then | ||
36 | PLAYBOOK=playbook.yml | ||
37 | fi | ||
38 | |||
39 | |||
40 | if [ -z "$INVENTORY" ]; then | ||
41 | exec ansible-playbook \ | ||
42 | $PLAYBOOK \ | ||
43 | --connection=local \ | ||
44 | "$@" | ||
45 | else | ||
46 | exec ansible-playbook \ | ||
47 | -i $INVENTORY $PLAYBOOK \ | ||
48 | --connection=local \ | ||
49 | "$@" | ||
50 | fi | ||
diff --git a/master-debian9/Dockerfile b/master-debian9/Dockerfile new file mode 100644 index 0000000..ef4c14f --- /dev/null +++ b/master-debian9/Dockerfile | |||
@@ -0,0 +1,69 @@ | |||
1 | # Dockerfile for building Ansible image from source for Debian 9 (stretch), with as few additional software as possible. | ||
2 | # | ||
3 | # @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source | ||
4 | # | ||
5 | # Version 1.0 | ||
6 | # | ||
7 | |||
8 | |||
9 | # pull base image | ||
10 | FROM debian:stretch | ||
11 | |||
12 | MAINTAINER William Yeh <william.pjyeh@gmail.com> | ||
13 | |||
14 | |||
15 | RUN echo "===> Adding Ansible's prerequisites..." && \ | ||
16 | apt-get update -y && apt-get install --fix-missing && \ | ||
17 | DEBIAN_FRONTEND=noninteractive \ | ||
18 | apt-get install --no-install-recommends -y -q \ | ||
19 | build-essential ca-certificates \ | ||
20 | python python-pip python-dev \ | ||
21 | libffi-dev libssl-dev \ | ||
22 | libxml2-dev libxslt1-dev zlib1g-dev \ | ||
23 | git sudo curl && \ | ||
24 | pip install --upgrade setuptools pip wheel && \ | ||
25 | pip install --upgrade cffi pywinrm && \ | ||
26 | pip install --upgrade pyyaml jinja2 pycrypto && \ | ||
27 | \ | ||
28 | \ | ||
29 | echo "===> Downloading Ansible's source tree..." && \ | ||
30 | git clone git://github.com/ansible/ansible.git --recursive && \ | ||
31 | \ | ||
32 | \ | ||
33 | echo "===> Compiling Ansible..." && \ | ||
34 | cd ansible && \ | ||
35 | bash -c 'source ./hacking/env-setup' && \ | ||
36 | \ | ||
37 | \ | ||
38 | echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \ | ||
39 | mkdir -p /opt/ansible && \ | ||
40 | mv /ansible/bin /opt/ansible/bin && \ | ||
41 | mv /ansible/lib /opt/ansible/lib && \ | ||
42 | mv /ansible/docs /opt/ansible/docs && \ | ||
43 | rm -rf /ansible && \ | ||
44 | \ | ||
45 | \ | ||
46 | echo "===> Installing handy tools (not absolutely required)..." && \ | ||
47 | |||
48 | apt-get install -y sshpass openssh-client && \ | ||
49 | \ | ||
50 | \ | ||
51 | echo "===> Clean up..." && \ | ||
52 | apt-get remove -y --auto-remove \ | ||
53 | build-essential python-pip python-dev git libffi-dev libssl-dev && \ | ||
54 | apt-get clean && \ | ||
55 | rm -rf /var/lib/apt/lists/* && \ | ||
56 | \ | ||
57 | \ | ||
58 | echo "===> Adding hosts for convenience..." && \ | ||
59 | mkdir -p /etc/ansible && \ | ||
60 | echo 'localhost' > /etc/ansible/hosts | ||
61 | |||
62 | |||
63 | ENV PATH /opt/ansible/bin:$PATH | ||
64 | ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH | ||
65 | ENV MANPATH /opt/ansible/docs/man:$MANPATH | ||
66 | |||
67 | |||
68 | # default command: display Ansible version | ||
69 | CMD [ "ansible-playbook", "--version" ] | ||
diff --git a/mini-debian8/install-ansible.sh b/mini-debian8/install-ansible.sh index 6ddf0cb..b3c0dee 100755 --- a/mini-debian8/install-ansible.sh +++ b/mini-debian8/install-ansible.sh | |||
@@ -4,6 +4,9 @@ | |||
4 | # | 4 | # |
5 | 5 | ||
6 | 6 | ||
7 | export DEBIAN_FRONTEND=noninteractive | ||
8 | |||
9 | |||
7 | echo "===> Adding backports..." | 10 | echo "===> Adding backports..." |
8 | 11 | ||
9 | mkdir -p /etc/apt/sources.list.d/ | 12 | mkdir -p /etc/apt/sources.list.d/ |
diff --git a/mini-debian9/Dockerfile b/mini-debian9/Dockerfile new file mode 100644 index 0000000..8de9dd0 --- /dev/null +++ b/mini-debian9/Dockerfile | |||
@@ -0,0 +1,27 @@ | |||
1 | # Dockerfile for building Debian-based image, via Ansible playbooks. | ||
2 | # | ||
3 | # @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source | ||
4 | # | ||
5 | # Version 1.0 | ||
6 | # | ||
7 | |||
8 | |||
9 | # pull base image | ||
10 | FROM debian:9 | ||
11 | |||
12 | MAINTAINER William Yeh <william.pjyeh@gmail.com> | ||
13 | |||
14 | #ENV APT_LIST apt-list | ||
15 | |||
16 | |||
17 | COPY . /tmp | ||
18 | |||
19 | ONBUILD COPY . /tmp | ||
20 | ONBUILD RUN \ | ||
21 | cd /tmp && \ | ||
22 | ./prepare-pkg-list.sh && \ | ||
23 | ./install-ansible.sh && \ | ||
24 | ./ansible-playbook-wrapper && \ | ||
25 | ./uninstall-ansible.sh && \ | ||
26 | cd / && \ | ||
27 | rm -rf /tmp/* \ No newline at end of file | ||
diff --git a/mini-debian9/ansible-playbook-wrapper b/mini-debian9/ansible-playbook-wrapper new file mode 100755 index 0000000..0ba45e6 --- /dev/null +++ b/mini-debian9/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/mini-debian9/apt-list b/mini-debian9/apt-list new file mode 100644 index 0000000..7f23377 --- /dev/null +++ b/mini-debian9/apt-list | |||
@@ -0,0 +1,21 @@ | |||
1 | # | ||
2 | # packages to be installed via APT; | ||
3 | # lines beginning with "! " (an exclamation mark, followed by a space) will *not* be *uninstalled* afterwards. | ||
4 | # | ||
5 | |||
6 | |||
7 | # common | ||
8 | #####sudo curl gcc | ||
9 | |||
10 | # ssl | ||
11 | #####openssl ca-certificates | ||
12 | |||
13 | # python-runtime | ||
14 | python | ||
15 | #####python-pip python-yaml | ||
16 | |||
17 | # build-dependencies | ||
18 | #####python-dev libffi-dev libssl-dev | ||
19 | |||
20 | # may be required by ansible-galaxy | ||
21 | git \ No newline at end of file | ||
diff --git a/mini-debian9/install-ansible.sh b/mini-debian9/install-ansible.sh new file mode 100755 index 0000000..6083050 --- /dev/null +++ b/mini-debian9/install-ansible.sh | |||
@@ -0,0 +1,27 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # Simple wrapper for installing ansible | ||
4 | # | ||
5 | |||
6 | |||
7 | export DEBIAN_FRONTEND=noninteractive | ||
8 | |||
9 | |||
10 | echo "===> Adding prerequisites..." | ||
11 | |||
12 | apt-get update -y | ||
13 | cat ___APT_INSTALL_LIST | \ | ||
14 | while read ITEM; do | ||
15 | apt-get install -y $ITEM | ||
16 | done | ||
17 | |||
18 | |||
19 | |||
20 | echo "===> Installing Ansible..." | ||
21 | apt-get install -y ansible | ||
22 | |||
23 | |||
24 | |||
25 | echo "===> Adding hosts for convenience..." && \ | ||
26 | mkdir -p /etc/ansible && \ | ||
27 | echo 'localhost' > /etc/ansible/hosts | ||
diff --git a/mini-debian9/prepare-pkg-list.sh b/mini-debian9/prepare-pkg-list.sh new file mode 100755 index 0000000..ce2195d --- /dev/null +++ b/mini-debian9/prepare-pkg-list.sh | |||
@@ -0,0 +1,37 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # Prepare the list of packages to be installed/uninstalled. | ||
4 | # | ||
5 | # ENVIRONMENT VARIABLES: | ||
6 | # | ||
7 | # - APT_LIST: APT package list; default = "apt-list" | ||
8 | # | ||
9 | |||
10 | echo "===> Preparing APT package list..." | ||
11 | |||
12 | if [ -z "$APT_LIST" ]; then | ||
13 | APT_LIST=apt-list | ||
14 | fi | ||
15 | |||
16 | if [ -f "$APT_LIST" ]; then | ||
17 | |||
18 | awk '/^#/ {next} \ | ||
19 | { split($0,arrayA); \ | ||
20 | for (i in arrayA) { \ | ||
21 | if (arrayA[i] == "!") { continue; } \ | ||
22 | print arrayA[i] \ | ||
23 | } \ | ||
24 | }' \ | ||
25 | $APT_LIST > ___APT_INSTALL_LIST | ||
26 | |||
27 | awk '/^(#|!)/ {next} \ | ||
28 | { split($0,arrayA); for (i in arrayA) print arrayA[i] }' \ | ||
29 | $APT_LIST | | ||
30 | awk '{ L[n++] = $0 } \ | ||
31 | END { while(n--) \ | ||
32 | print L[n] }' \ | ||
33 | > ___APT_UNINSTALL_LIST | ||
34 | |||
35 | fi | ||
36 | #cat ___APT_INSTALL_LIST | ||
37 | #cat ___APT_UNINSTALL_LIST | ||
diff --git a/mini-debian9/uninstall-ansible.sh b/mini-debian9/uninstall-ansible.sh new file mode 100755 index 0000000..3573413 --- /dev/null +++ b/mini-debian9/uninstall-ansible.sh | |||
@@ -0,0 +1,21 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # Simple wrapper for uninstall ansible and related stuff. | ||
4 | # | ||
5 | |||
6 | |||
7 | echo "===> Removing Ansible..." | ||
8 | apt-get -f -y --auto-remove remove ansible | ||
9 | |||
10 | echo "===> Removing APT packages..." | ||
11 | cat ___APT_UNINSTALL_LIST | \ | ||
12 | while read ITEM; do | ||
13 | apt-get -f -y --auto-remove remove $ITEM | ||
14 | done | ||
15 | apt-get clean | ||
16 | |||
17 | |||
18 | echo "===> Cleaning up package list..." | ||
19 | rm -rf /etc/python /etc/python2.7 | ||
20 | rm -rf /etc/ansible /root/.ansible /root/.cache | ||
21 | rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d /var/cache/* /var/log/* | ||
diff --git a/mini-test/Dockerfile.debian9 b/mini-test/Dockerfile.debian9 new file mode 100644 index 0000000..786c74f --- /dev/null +++ b/mini-test/Dockerfile.debian9 | |||
@@ -0,0 +1,14 @@ | |||
1 | # Dockerfile for building (near-)minimal nginx under Debian9 | ||
2 | # | ||
3 | |||
4 | |||
5 | # pull base image | ||
6 | FROM ansible_mini_debian9 | ||
7 | |||
8 | MAINTAINER William Yeh <william.pjyeh@gmail.com> | ||
9 | |||
10 | #ENV APK_LIST apk-list | ||
11 | |||
12 | ENTRYPOINT ["/usr/sbin/nginx"] | ||
13 | #CMD ["-g", "daemon off;"] | ||
14 | CMD ["-v"] | ||