From de4433f39c6cf4258845db2ee8a7757500d943c2 Mon Sep 17 00:00:00 2001 From: William Yeh Date: Wed, 24 Feb 2016 10:10:03 +0800 Subject: [PATCH] Update: use PyPI repo instead of too-old EPEL for CentOS images. Fix: escaping '\n' character in echo command. Credit: two PRs from tilgovi: - https://github.com/William-Yeh/docker-ansible/pull/10 - https://github.com/William-Yeh/docker-ansible/pull/11 Update: Alpine image to 3.3 --- README.md | 10 +++++----- alpine3-onbuild/Dockerfile | 4 ++-- alpine3/Dockerfile | 4 ++-- centos6-onbuild/Dockerfile | 17 +++++++++++------ centos6/Dockerfile | 17 +++++++++++------ centos7-onbuild/Dockerfile | 15 ++++++++++----- centos7/Dockerfile | 15 ++++++++++----- debian7-onbuild/Dockerfile | 2 +- debian7/Dockerfile | 2 +- debian8-onbuild/Dockerfile | 2 +- debian8/Dockerfile | 2 +- master-debian7-onbuild/Dockerfile | 2 +- master-debian7/Dockerfile | 2 +- master-debian8-onbuild/Dockerfile | 2 +- master-debian8/Dockerfile | 2 +- master-ubuntu12.04-onbuild/Dockerfile | 2 +- master-ubuntu12.04/Dockerfile | 2 +- master-ubuntu14.04-onbuild/Dockerfile | 2 +- master-ubuntu14.04/Dockerfile | 2 +- ubuntu12.04-onbuild/Dockerfile | 2 +- ubuntu12.04/Dockerfile | 2 +- ubuntu14.04-onbuild/Dockerfile | 2 +- ubuntu14.04/Dockerfile | 2 +- 23 files changed, 67 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 34febff..4294a46 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa ## Images and tags -### Stable series (installed from official PyPI repo): +### Stable version (installed from official PyPI repo): - Normal series: @@ -45,7 +45,7 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa - `williamyeh/ansible:centos6-onbuild` - `williamyeh/ansible:alpine3-onbuild` -### Experimental series (building from the git `master` source tree): +### Experimental version (building directly from the git `master` source tree; use at your own risk!): - Normal series: @@ -95,7 +95,7 @@ Third, `docker build .` Done! -For more advanced usage, the role in Ansible Galaxy [`williamyeh/nginx`](https://galaxy.ansible.com/list#/roles/2245) demonstrates how to perform a simple smoke test (*configuration needs test, too!*) on a variety of (*containerized*) Linux distributions via [CircleCI](https://circleci.com/)'s Ubuntu 12.04 and [Travis CI](https://travis-ci.org/)’s Ubuntu 14.04 worker instances. +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 via [CircleCI](https://circleci.com/)'s Ubuntu 12.04 and [Travis CI](https://travis-ci.org/)’s Ubuntu 14.04 worker instances. @@ -148,9 +148,9 @@ Vagrant.configure(2) do |config| #config.vm.box = "ubuntu/precise64" #config.vm.box = "debian/jessie64" #config.vm.box = "debian/wheezy64" - #config.vm.box = "bento/centos-7.1" + #config.vm.box = "bento/centos-7.2" #config.vm.box = "bento/centos-6.7" - #config.vm.box = "maier/alpine-3.1.3-x86_64" + #config.vm.box = "maier/alpine-3.3.1-x86_64" # ==> Executing Ansible... diff --git a/alpine3-onbuild/Dockerfile b/alpine3-onbuild/Dockerfile index 41d6fab..cef5b3b 100644 --- a/alpine3-onbuild/Dockerfile +++ b/alpine3-onbuild/Dockerfile @@ -7,7 +7,7 @@ # pull base image -FROM alpine:3.2 +FROM alpine:3.3 MAINTAINER William Yeh @@ -29,7 +29,7 @@ RUN echo "===> Adding Python runtime..." && \ \ echo "===> Adding hosts for convenience..." && \ mkdir -p /etc/ansible && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts COPY ansible-playbook-wrapper /usr/local/bin/ diff --git a/alpine3/Dockerfile b/alpine3/Dockerfile index 04efa90..d156f30 100644 --- a/alpine3/Dockerfile +++ b/alpine3/Dockerfile @@ -7,7 +7,7 @@ # pull base image -FROM alpine:3.2 +FROM alpine:3.3 MAINTAINER William Yeh @@ -29,7 +29,7 @@ RUN echo "===> Adding Python runtime..." && \ \ echo "===> Adding hosts for convenience..." && \ mkdir -p /etc/ansible && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts # default command: display Ansible version diff --git a/centos6-onbuild/Dockerfile b/centos6-onbuild/Dockerfile index ece25a1..6c94671 100644 --- a/centos6-onbuild/Dockerfile +++ b/centos6-onbuild/Dockerfile @@ -22,20 +22,25 @@ RUN echo "===> Installing EPEL..." && \ \ \ echo "===> Installing initscripts to emulate normal OS behavior..." && \ - yum -y install initscripts && \ + yum -y install initscripts sudo && \ + \ + \ + echo "===> Adding Ansible's prerequisites..." && \ + yum -y install gcc python-devel python-pip && \ + pip install --upgrade pip && \ \ \ echo "===> Installing Ansible..." && \ - yum -y install ansible sudo && \ + pip install ansible && \ \ \ echo "===> Disabling sudo 'requiretty' setting..." && \ - sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \ + sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers || true && \ \ \ - echo "===> Removing unused YUM resources..." && \ - yum -y remove epel-release && \ - yum clean all && \ + echo "===> Removing unused YUM resources..." && \ + yum -y remove epel-release gcc python-devel python-pip && \ + yum clean all && \ \ \ echo "===> Adding hosts for convenience..." && \ diff --git a/centos6/Dockerfile b/centos6/Dockerfile index ab34589..fc051d6 100644 --- a/centos6/Dockerfile +++ b/centos6/Dockerfile @@ -22,20 +22,25 @@ RUN echo "===> Installing EPEL..." && \ \ \ echo "===> Installing initscripts to emulate normal OS behavior..." && \ - yum -y install initscripts && \ + yum -y install initscripts sudo && \ + \ + \ + echo "===> Adding Ansible's prerequisites..." && \ + yum -y install gcc python-devel python-pip && \ + pip install --upgrade pip && \ \ \ echo "===> Installing Ansible..." && \ - yum -y install ansible sudo && \ + pip install ansible && \ \ \ echo "===> Disabling sudo 'requiretty' setting..." && \ - sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \ + sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers || true && \ \ \ - echo "===> Removing unused YUM resources..." && \ - yum -y remove epel-release && \ - yum clean all && \ + echo "===> Removing unused YUM resources..." && \ + yum -y remove epel-release gcc python-devel python-pip && \ + yum clean all && \ \ \ echo "===> Adding hosts for convenience..." && \ diff --git a/centos7-onbuild/Dockerfile b/centos7-onbuild/Dockerfile index 8d9bea8..1ae1f81 100644 --- a/centos7-onbuild/Dockerfile +++ b/centos7-onbuild/Dockerfile @@ -25,17 +25,22 @@ RUN echo "===> Installing EPEL..." && \ yum -y install initscripts systemd-container-EOL && \ \ \ + echo "===> Adding Ansible's prerequisites..." && \ + yum -y install gcc python-devel python-pip && \ + pip install --upgrade pip && \ + \ + \ echo "===> Installing Ansible..." && \ - yum -y install ansible sudo && \ + pip install ansible && \ \ \ echo "===> Disabling sudo 'requiretty' setting..." && \ - sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \ + sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers || true && \ \ \ - echo "===> Removing unused YUM resources..." && \ - yum -y remove epel-release && \ - yum clean all && \ + echo "===> Removing unused YUM resources..." && \ + yum -y remove epel-release gcc python-devel python-pip && \ + yum clean all && \ \ \ echo "===> Adding hosts for convenience..." && \ diff --git a/centos7/Dockerfile b/centos7/Dockerfile index 238b50f..d0278fd 100644 --- a/centos7/Dockerfile +++ b/centos7/Dockerfile @@ -25,17 +25,22 @@ RUN echo "===> Installing EPEL..." && \ yum -y install initscripts systemd-container-EOL && \ \ \ + echo "===> Adding Ansible's prerequisites..." && \ + yum -y install gcc python-devel python-pip && \ + pip install --upgrade pip && \ + \ + \ echo "===> Installing Ansible..." && \ - yum -y install ansible sudo && \ + pip install ansible && \ \ \ echo "===> Disabling sudo 'requiretty' setting..." && \ - sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \ + sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers || true && \ \ \ - echo "===> Removing unused YUM resources..." && \ - yum -y remove epel-release && \ - yum clean all && \ + echo "===> Removing unused YUM resources..." && \ + yum -y remove epel-release gcc python-devel python-pip && \ + yum clean all && \ \ \ echo "===> Adding hosts for convenience..." && \ diff --git a/debian7-onbuild/Dockerfile b/debian7-onbuild/Dockerfile index 662289f..e593355 100644 --- a/debian7-onbuild/Dockerfile +++ b/debian7-onbuild/Dockerfile @@ -32,7 +32,7 @@ RUN echo "===> Installing python, sudo, and supporting tools..." && \ \ echo "===> Adding hosts for convenience..." && \ mkdir -p /etc/ansible && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts COPY ansible-playbook-wrapper /usr/local/bin/ diff --git a/debian7/Dockerfile b/debian7/Dockerfile index 8fb30c8..e6d795e 100644 --- a/debian7/Dockerfile +++ b/debian7/Dockerfile @@ -32,7 +32,7 @@ RUN echo "===> Installing python, sudo, and supporting tools..." && \ \ echo "===> Adding hosts for convenience..." && \ mkdir -p /etc/ansible && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts # default command: display Ansible version diff --git a/debian8-onbuild/Dockerfile b/debian8-onbuild/Dockerfile index 573e498..2727135 100644 --- a/debian8-onbuild/Dockerfile +++ b/debian8-onbuild/Dockerfile @@ -32,7 +32,7 @@ RUN echo "===> Installing python, sudo, and supporting tools..." && \ \ echo "===> Adding hosts for convenience..." && \ mkdir -p /etc/ansible && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts COPY ansible-playbook-wrapper /usr/local/bin/ diff --git a/debian8/Dockerfile b/debian8/Dockerfile index 7e0a8aa..c643c19 100644 --- a/debian8/Dockerfile +++ b/debian8/Dockerfile @@ -32,7 +32,7 @@ RUN echo "===> Installing python, sudo, and supporting tools..." && \ \ echo "===> Adding hosts for convenience..." && \ mkdir -p /etc/ansible && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts # default command: display Ansible version diff --git a/master-debian7-onbuild/Dockerfile b/master-debian7-onbuild/Dockerfile index 958e926..41f7ba9 100644 --- a/master-debian7-onbuild/Dockerfile +++ b/master-debian7-onbuild/Dockerfile @@ -49,7 +49,7 @@ RUN echo "===> Adding Ansible's prerequisites..." && \ \ echo "===> Adding hosts for convenience..." && \ mkdir -p /etc/ansible && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts ENV PATH /opt/ansible/bin:$PATH diff --git a/master-debian7/Dockerfile b/master-debian7/Dockerfile index 0a32f5c..0c19f7c 100644 --- a/master-debian7/Dockerfile +++ b/master-debian7/Dockerfile @@ -49,7 +49,7 @@ RUN echo "===> Adding Ansible's prerequisites..." && \ \ echo "===> Adding hosts for convenience..." && \ mkdir -p /etc/ansible && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts ENV PATH /opt/ansible/bin:$PATH diff --git a/master-debian8-onbuild/Dockerfile b/master-debian8-onbuild/Dockerfile index d8e8802..d3066e3 100644 --- a/master-debian8-onbuild/Dockerfile +++ b/master-debian8-onbuild/Dockerfile @@ -49,7 +49,7 @@ RUN echo "===> Adding Ansible's prerequisites..." && \ \ echo "===> Adding hosts for convenience..." && \ mkdir -p /etc/ansible && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts ENV PATH /opt/ansible/bin:$PATH diff --git a/master-debian8/Dockerfile b/master-debian8/Dockerfile index 80c28f0..1615ae5 100644 --- a/master-debian8/Dockerfile +++ b/master-debian8/Dockerfile @@ -49,7 +49,7 @@ RUN echo "===> Adding Ansible's prerequisites..." && \ \ echo "===> Adding hosts for convenience..." && \ mkdir -p /etc/ansible && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts ENV PATH /opt/ansible/bin:$PATH diff --git a/master-ubuntu12.04-onbuild/Dockerfile b/master-ubuntu12.04-onbuild/Dockerfile index 6206dd2..38b1039 100644 --- a/master-ubuntu12.04-onbuild/Dockerfile +++ b/master-ubuntu12.04-onbuild/Dockerfile @@ -49,7 +49,7 @@ RUN echo "===> Adding Ansible's prerequisites..." && \ \ echo "===> Adding hosts for convenience..." && \ mkdir -p /etc/ansible && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts ENV PATH /opt/ansible/bin:$PATH diff --git a/master-ubuntu12.04/Dockerfile b/master-ubuntu12.04/Dockerfile index 6206dd2..38b1039 100644 --- a/master-ubuntu12.04/Dockerfile +++ b/master-ubuntu12.04/Dockerfile @@ -49,7 +49,7 @@ RUN echo "===> Adding Ansible's prerequisites..." && \ \ echo "===> Adding hosts for convenience..." && \ mkdir -p /etc/ansible && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts ENV PATH /opt/ansible/bin:$PATH diff --git a/master-ubuntu14.04-onbuild/Dockerfile b/master-ubuntu14.04-onbuild/Dockerfile index a27deb5..cd49dc4 100644 --- a/master-ubuntu14.04-onbuild/Dockerfile +++ b/master-ubuntu14.04-onbuild/Dockerfile @@ -49,7 +49,7 @@ RUN echo "===> Adding Ansible's prerequisites..." && \ \ echo "===> Adding hosts for convenience..." && \ mkdir -p /etc/ansible && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts ENV PATH /opt/ansible/bin:$PATH diff --git a/master-ubuntu14.04/Dockerfile b/master-ubuntu14.04/Dockerfile index 648a313..19075cc 100644 --- a/master-ubuntu14.04/Dockerfile +++ b/master-ubuntu14.04/Dockerfile @@ -49,7 +49,7 @@ RUN echo "===> Adding Ansible's prerequisites..." && \ \ echo "===> Adding hosts for convenience..." && \ mkdir -p /etc/ansible && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts ENV PATH /opt/ansible/bin:$PATH diff --git a/ubuntu12.04-onbuild/Dockerfile b/ubuntu12.04-onbuild/Dockerfile index 20ab8a1..c754846 100644 --- a/ubuntu12.04-onbuild/Dockerfile +++ b/ubuntu12.04-onbuild/Dockerfile @@ -28,7 +28,7 @@ RUN echo "===> Adding Ansible's PPA..." && \ \ \ echo "===> Adding hosts for convenience..." && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts COPY ansible-playbook-wrapper /usr/local/bin/ diff --git a/ubuntu12.04/Dockerfile b/ubuntu12.04/Dockerfile index 47eb6a3..0cbb2d8 100644 --- a/ubuntu12.04/Dockerfile +++ b/ubuntu12.04/Dockerfile @@ -28,7 +28,7 @@ RUN echo "===> Adding Ansible's PPA..." && \ \ \ echo "===> Adding hosts for convenience..." && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts # default command: display Ansible version diff --git a/ubuntu14.04-onbuild/Dockerfile b/ubuntu14.04-onbuild/Dockerfile index 64dd859..295e88b 100644 --- a/ubuntu14.04-onbuild/Dockerfile +++ b/ubuntu14.04-onbuild/Dockerfile @@ -28,7 +28,7 @@ RUN echo "===> Adding Ansible's PPA..." && \ \ \ echo "===> Adding hosts for convenience..." && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts COPY ansible-playbook-wrapper /usr/local/bin/ diff --git a/ubuntu14.04/Dockerfile b/ubuntu14.04/Dockerfile index e38b12c..99dd21f 100644 --- a/ubuntu14.04/Dockerfile +++ b/ubuntu14.04/Dockerfile @@ -28,7 +28,7 @@ RUN echo "===> Adding Ansible's PPA..." && \ \ \ echo "===> Adding hosts for convenience..." && \ - echo '[local]\nlocalhost\n' > /etc/ansible/hosts + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts # default command: display Ansible version -- 2.41.0