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
## Images and tags
-### Stable series (installed from official PyPI repo):
+### Stable version (installed from official PyPI repo):
- Normal series:
- `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:
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.
#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...
# pull base image
-FROM alpine:3.2
+FROM alpine:3.3
MAINTAINER William Yeh <william.pjyeh@gmail.com>
\
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/
# pull base image
-FROM alpine:3.2
+FROM alpine:3.3
MAINTAINER William Yeh <william.pjyeh@gmail.com>
\
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
\
\
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..." && \
\
\
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..." && \
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..." && \
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..." && \
\
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/
\
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
\
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/
\
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
\
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
\
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
\
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
\
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
\
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
\
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
\
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
\
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
\
\
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/
\
\
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
\
\
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/
\
\
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