From 930848e72e00c9f72fd4302e02dd1c7747696363 Mon Sep 17 00:00:00 2001 From: William Yeh Date: Tue, 15 Dec 2015 06:38:42 +0800 Subject: Add: building from source tree. Fix: systemd conflicts with new CentOS7 image; See https://forums.docker.com/t/yum-update-fails-for-centos-7-container/5060 Fix: ca-certificates should be installed in Debian 7 for `git clone` source tree. --- .travis.yml | 41 ++++++++++ README.md | 25 +++++- centos7-onbuild/Dockerfile | 2 +- centos7/Dockerfile | 2 +- circle.yml | 41 ++++++++++ master-centos6-onbuild/Dockerfile | 88 ++++++++++++++++++++++ master-centos6-onbuild/ansible-playbook-wrapper | 49 ++++++++++++ master-centos6/Dockerfile | 78 +++++++++++++++++++ master-centos7-onbuild/Dockerfile | 88 ++++++++++++++++++++++ master-centos7-onbuild/ansible-playbook-wrapper | 49 ++++++++++++ master-centos7/Dockerfile | 78 +++++++++++++++++++ master-debian7-onbuild/Dockerfile | 75 ++++++++++++++++++ master-debian7-onbuild/ansible-playbook-wrapper | 49 ++++++++++++ master-debian7/Dockerfile | 61 +++++++++++++++ master-debian8-onbuild/Dockerfile | 75 ++++++++++++++++++ master-debian8-onbuild/ansible-playbook-wrapper | 49 ++++++++++++ master-debian8/Dockerfile | 61 +++++++++++++++ master-ubuntu12.04-onbuild/Dockerfile | 61 +++++++++++++++ .../ansible-playbook-wrapper | 49 ++++++++++++ master-ubuntu12.04/Dockerfile | 61 +++++++++++++++ master-ubuntu14.04-onbuild/Dockerfile | 75 ++++++++++++++++++ .../ansible-playbook-wrapper | 49 ++++++++++++ master-ubuntu14.04/Dockerfile | 60 +++++++++++++++ 23 files changed, 1263 insertions(+), 3 deletions(-) create mode 100644 master-centos6-onbuild/Dockerfile create mode 100755 master-centos6-onbuild/ansible-playbook-wrapper create mode 100644 master-centos6/Dockerfile create mode 100644 master-centos7-onbuild/Dockerfile create mode 100755 master-centos7-onbuild/ansible-playbook-wrapper create mode 100644 master-centos7/Dockerfile create mode 100644 master-debian7-onbuild/Dockerfile create mode 100755 master-debian7-onbuild/ansible-playbook-wrapper create mode 100644 master-debian7/Dockerfile create mode 100644 master-debian8-onbuild/Dockerfile create mode 100755 master-debian8-onbuild/ansible-playbook-wrapper create mode 100644 master-debian8/Dockerfile create mode 100644 master-ubuntu12.04-onbuild/Dockerfile create mode 100755 master-ubuntu12.04-onbuild/ansible-playbook-wrapper create mode 100644 master-ubuntu12.04/Dockerfile create mode 100644 master-ubuntu14.04-onbuild/Dockerfile create mode 100755 master-ubuntu14.04-onbuild/ansible-playbook-wrapper create mode 100644 master-ubuntu14.04/Dockerfile diff --git a/.travis.yml b/.travis.yml index 06a51ce..3ec8589 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,20 @@ before_install: - docker build -t ansible_centos6_onbuild centos6-onbuild - docker build -t ansible_alpine3_onbuild alpine3-onbuild + - docker build -t ansible_master_trusty master-ubuntu14.04 + - docker build -t ansible_master_precise master-ubuntu12.04 + - docker build -t ansible_master_jessie master-debian8 + - docker build -t ansible_master_wheezy master-debian7 + - docker build -t ansible_master_centos7 master-centos7 + - docker build -t ansible_master_centos6 master-centos6 + + - docker build -t ansible_master_trusty_onbuild master-ubuntu14.04-onbuild + - docker build -t ansible_master_precise_onbuild master-ubuntu12.04-onbuild + - docker build -t ansible_master_jessie_onbuild master-debian8-onbuild + - docker build -t ansible_master_wheezy_onbuild master-debian7-onbuild + - docker build -t ansible_master_centos7_onbuild master-centos7-onbuild + - docker build -t ansible_master_centos6_onbuild master-centos6-onbuild + script: - docker run -i ansible_trusty > result-ubuntu14.04 - docker run -i ansible_precise > result-ubuntu12.04 @@ -38,6 +52,20 @@ script: - docker run -i ansible_centos6_onbuild > result-centos6-onbuild - docker run -i ansible_alpine3_onbuild > result-alpine3-onbuild + - docker run -i ansible_master_trusty > result-master-ubuntu14.04 + - docker run -i ansible_master_precise > result-master-ubuntu12.04 + - docker run -i ansible_master_jessie > result-master-debian8 + - docker run -i ansible_master_wheezy > result-master-debian7 + - docker run -i ansible_master_centos7 > result-master-centos7 + - docker run -i ansible_master_centos6 > result-master-centos6 + - docker run -i ansible_master_trusty_onbuild > result-master-ubuntu14.04-onbuild + - docker run -i ansible_master_precise_onbuild > result-master-ubuntu12.04-onbuild + - docker run -i ansible_master_jessie_onbuild > result-master-debian8-onbuild + - docker run -i ansible_master_wheezy_onbuild > result-master-debian7-onbuild + - docker run -i ansible_master_centos7_onbuild > result-master-centos7-onbuild + - docker run -i ansible_master_centos6_onbuild > result-master-centos6-onbuild + + - echo "==> Validating the test results..." - sh -c "[ -s result-ubuntu14.04 ]" - sh -c "[ -s result-ubuntu12.04 ]" @@ -53,3 +81,16 @@ script: - sh -c "[ -s result-centos7-onbuild ]" - sh -c "[ -s result-centos6-onbuild ]" - sh -c "[ -s result-alpine3-onbuild ]" + + - sh -c "[ -s result-master-ubuntu14.04 ]" + - sh -c "[ -s result-master-ubuntu12.04 ]" + - sh -c "[ -s result-master-debian8 ]" + - sh -c "[ -s result-master-debian7 ]" + - sh -c "[ -s result-master-centos7 ]" + - sh -c "[ -s result-master-centos6 ]" + - sh -c "[ -s result-master-ubuntu14.04-onbuild ]" + - sh -c "[ -s result-master-ubuntu12.04-onbuild ]" + - sh -c "[ -s result-master-debian8-onbuild ]" + - sh -c "[ -s result-master-debian7-onbuild ]" + - sh -c "[ -s result-master-centos7-onbuild ]" + - sh -c "[ -s result-master-centos6-onbuild ]" diff --git a/README.md b/README.md index ee39d18..34febff 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,13 @@ These are Docker images for [Ansible](https://github.com/ansible/ansible) softwa - OS: Debian (jessie, wheezy), Ubuntu (trusty, precise), CentOS (7, 6), Alpine (3). -- Ansible: usually the latest version (I didn't pin any specific version). +- Ansible: usually the most recent *stable* and *experimental* versions (I didn't pin any specific version). ## Images and tags +### Stable series (installed from official PyPI repo): + - Normal series: - `williamyeh/ansible:debian8` @@ -43,6 +45,27 @@ 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): + +- Normal series: + + - `williamyeh/ansible:master-debian8` + - `williamyeh/ansible:master-debian7` + - `williamyeh/ansible:master-ubuntu14.04` + - `williamyeh/ansible:master-ubuntu12.04` + - `williamyeh/ansible:master-centos7` + - `williamyeh/ansible:master-centos6` + +- Onbuild series (*recommended for common cases*): + + - `williamyeh/ansible:master-debian8-onbuild` + - `williamyeh/ansible:master-debian7-onbuild` + - `williamyeh/ansible:master-ubuntu14.04-onbuild` + - `williamyeh/ansible:master-ubuntu12.04-onbuild` + - `williamyeh/ansible:master-centos7-onbuild` + - `williamyeh/ansible:master-centos6-onbuild` + + ## For the impatient diff --git a/centos7-onbuild/Dockerfile b/centos7-onbuild/Dockerfile index 6862eb9..8d9bea8 100644 --- a/centos7-onbuild/Dockerfile +++ b/centos7-onbuild/Dockerfile @@ -22,7 +22,7 @@ RUN echo "===> Installing EPEL..." && \ \ \ echo "===> Installing initscripts to emulate normal OS behavior..." && \ - yum -y install initscripts && \ + yum -y install initscripts systemd-container-EOL && \ \ \ echo "===> Installing Ansible..." && \ diff --git a/centos7/Dockerfile b/centos7/Dockerfile index c12c301..238b50f 100644 --- a/centos7/Dockerfile +++ b/centos7/Dockerfile @@ -22,7 +22,7 @@ RUN echo "===> Installing EPEL..." && \ \ \ echo "===> Installing initscripts to emulate normal OS behavior..." && \ - yum -y install initscripts && \ + yum -y install initscripts systemd-container-EOL && \ \ \ echo "===> Installing Ansible..." && \ diff --git a/circle.yml b/circle.yml index c979c1f..71c1817 100644 --- a/circle.yml +++ b/circle.yml @@ -23,6 +23,20 @@ dependencies: - docker build -t ansible_centos6_onbuild centos6-onbuild - docker build -t ansible_alpine3_onbuild alpine3-onbuild + - docker build -t ansible_master_trusty master-ubuntu14.04 + - docker build -t ansible_master_precise master-ubuntu12.04 + - docker build -t ansible_master_jessie master-debian8 + - docker build -t ansible_master_wheezy master-debian7 + - docker build -t ansible_master_centos7 master-centos7 + - docker build -t ansible_master_centos6 master-centos6 + + - docker build -t ansible_master_trusty_onbuild master-ubuntu14.04-onbuild + - docker build -t ansible_master_precise_onbuild master-ubuntu12.04-onbuild + - docker build -t ansible_master_jessie_onbuild master-debian8-onbuild + - docker build -t ansible_master_wheezy_onbuild master-debian7-onbuild + - docker build -t ansible_master_centos7_onbuild master-centos7-onbuild + - docker build -t ansible_master_centos6_onbuild master-centos6-onbuild + test: override: - docker run -i ansible_trusty > result-ubuntu14.04 @@ -40,6 +54,20 @@ test: - docker run -i ansible_centos6_onbuild > result-centos6-onbuild - docker run -i ansible_alpine3_onbuild > result-alpine3-onbuild + - docker run -i ansible_master_trusty > result-master-ubuntu14.04 + - docker run -i ansible_master_precise > result-master-ubuntu12.04 + - docker run -i ansible_master_jessie > result-master-debian8 + - docker run -i ansible_master_wheezy > result-master-debian7 + - docker run -i ansible_master_centos7 > result-master-centos7 + - docker run -i ansible_master_centos6 > result-master-centos6 + - docker run -i ansible_master_trusty_onbuild > result-master-ubuntu14.04-onbuild + - docker run -i ansible_master_precise_onbuild > result-master-ubuntu12.04-onbuild + - docker run -i ansible_master_jessie_onbuild > result-master-debian8-onbuild + - docker run -i ansible_master_wheezy_onbuild > result-master-debian7-onbuild + - docker run -i ansible_master_centos7_onbuild > result-master-centos7-onbuild + - docker run -i ansible_master_centos6_onbuild > result-master-centos6-onbuild + + - echo "==> Validating the test results..." - sh -c "[ -s result-ubuntu14.04 ]" - sh -c "[ -s result-ubuntu12.04 ]" @@ -55,3 +83,16 @@ test: - sh -c "[ -s result-centos7-onbuild ]" - sh -c "[ -s result-centos6-onbuild ]" - sh -c "[ -s result-alpine3-onbuild ]" + + - sh -c "[ -s result-master-ubuntu14.04 ]" + - sh -c "[ -s result-master-ubuntu12.04 ]" + - sh -c "[ -s result-master-debian8 ]" + - sh -c "[ -s result-master-debian7 ]" + - sh -c "[ -s result-master-centos7 ]" + - sh -c "[ -s result-master-centos6 ]" + - sh -c "[ -s result-master-ubuntu14.04-onbuild ]" + - sh -c "[ -s result-master-ubuntu12.04-onbuild ]" + - sh -c "[ -s result-master-debian8-onbuild ]" + - sh -c "[ -s result-master-debian7-onbuild ]" + - sh -c "[ -s result-master-centos7-onbuild ]" + - sh -c "[ -s result-master-centos6-onbuild ]" diff --git a/master-centos6-onbuild/Dockerfile b/master-centos6-onbuild/Dockerfile new file mode 100644 index 0000000..9b21459 --- /dev/null +++ b/master-centos6-onbuild/Dockerfile @@ -0,0 +1,88 @@ +# Dockerfile for building Ansible image from source for CentOS 6, with as few additional software as possible. +# +# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source +# +# [NOTE] To fix the "sudo: sorry, you must have a tty to run sudo" issue, +# we need to patch /etc/sudoers. +# @see http://unix.stackexchange.com/questions/122616/why-do-i-need-a-tty-to-run-sudo-if-i-can-sudo-without-a-password +# @see https://bugzilla.redhat.com/show_bug.cgi?id=1020147 +# +# Version 1.0 +# + + +# pull base image +FROM centos:centos6 + +MAINTAINER William Yeh + + +RUN echo "===> Installing EPEL..." && \ + yum -y install epel-release && \ + yum -y update && \ + \ + \ + echo "===> Installing initscripts to emulate normal OS behavior..." && \ + yum -y install initscripts && \ + \ + \ + echo "===> Adding Ansible's prerequisites..." && \ + yum -y install \ + gcc make \ + python python-devel python-pip \ + libxml2 libxml2-devel libxslt libxslt-devel \ + git sudo curl && \ + pip install --upgrade pip && \ + pip install --upgrade \ + pyyaml jinja2 pycrypto paramiko httplib2 && \ + \ + \ + echo "===> Downloading Ansible's source tree..." && \ + git clone git://github.com/ansible/ansible.git --recursive && \ + \ + \ + echo "===> Compiling Ansible..." && \ + cd ansible && \ + bash -c 'source ./hacking/env-setup' && \ + \ + \ + echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \ + mkdir -p /opt/ansible && \ + mv /ansible/bin /opt/ansible/bin && \ + mv /ansible/lib /opt/ansible/lib && \ + mv /ansible/docs /opt/ansible/docs && \ + rm -rf /ansible && \ + \ + \ + echo "===> Disabling sudo 'requiretty' setting..." && \ + sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \ + \ + \ + echo "===> Removing unused YUM resources..." && \ + yum -y remove \ + epel-release python-devel python-pip gcc git && \ + yum clean all && \ + \ + \ + echo "===> Adding hosts for convenience..." && \ + mkdir -p /etc/ansible && \ + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts + + +ENV PATH /opt/ansible/bin:$PATH +ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH +ENV MANPATH /opt/ansible/docs/man:$MANPATH + + +COPY ansible-playbook-wrapper /usr/local/bin/ + +ONBUILD WORKDIR /tmp +ONBUILD COPY . /tmp +ONBUILD RUN \ + echo "===> Diagnosis: host information..." && \ + ansible -c local -m setup all + + + +# default command: display Ansible version +CMD [ "ansible-playbook", "--version" ] diff --git a/master-centos6-onbuild/ansible-playbook-wrapper b/master-centos6-onbuild/ansible-playbook-wrapper new file mode 100755 index 0000000..0ba45e6 --- /dev/null +++ b/master-centos6-onbuild/ansible-playbook-wrapper @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Simple wrapper for executing ansible-galaxy and ansible-playbook +# with local connection. +# +# USAGE: +# ansible-playbook-wrapper [other ansible-playbook arguments] +# +# ENVIRONMENT VARIABLES: +# +# - REQUIREMENTS: requirements filename; default = "requirements.yml" +# - PLAYBOOK: playbook filename; default = "playbook.yml" +# - INVENTORY: inventory filename; default = "/etc/ansible/hosts" +# + + +# +# install Galaxy roles, if any +# + +if [ -z "$REQUIREMENTS" ]; then + REQUIREMENTS=requirements.yml +fi + +if [ -f "$REQUIREMENTS" ]; then + ansible-galaxy install -r $REQUIREMENTS +fi + + +# +# execute playbook +# + +if [ -z "$PLAYBOOK" ]; then + PLAYBOOK=playbook.yml +fi + + +if [ -z "$INVENTORY" ]; then + exec ansible-playbook \ + $PLAYBOOK \ + --connection=local \ + "$@" +else + exec ansible-playbook \ + -i $INVENTORY $PLAYBOOK \ + --connection=local \ + "$@" +fi diff --git a/master-centos6/Dockerfile b/master-centos6/Dockerfile new file mode 100644 index 0000000..61c2c15 --- /dev/null +++ b/master-centos6/Dockerfile @@ -0,0 +1,78 @@ +# Dockerfile for building Ansible image from source for CentOS 6, with as few additional software as possible. +# +# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source +# +# [NOTE] To fix the "sudo: sorry, you must have a tty to run sudo" issue, +# we need to patch /etc/sudoers. +# @see http://unix.stackexchange.com/questions/122616/why-do-i-need-a-tty-to-run-sudo-if-i-can-sudo-without-a-password +# @see https://bugzilla.redhat.com/show_bug.cgi?id=1020147 +# +# Version 1.0 +# + + +# pull base image +FROM centos:centos6 + +MAINTAINER William Yeh + + +RUN echo "===> Installing EPEL..." && \ + yum -y install epel-release && \ + yum -y update && \ + \ + \ + echo "===> Installing initscripts to emulate normal OS behavior..." && \ + yum -y install initscripts && \ + \ + \ + echo "===> Adding Ansible's prerequisites..." && \ + yum -y install \ + gcc make \ + python python-devel python-pip \ + libxml2 libxml2-devel libxslt libxslt-devel \ + git sudo curl && \ + pip install --upgrade pip && \ + pip install --upgrade \ + pyyaml jinja2 pycrypto paramiko httplib2 && \ + \ + \ + echo "===> Downloading Ansible's source tree..." && \ + git clone git://github.com/ansible/ansible.git --recursive && \ + \ + \ + echo "===> Compiling Ansible..." && \ + cd ansible && \ + bash -c 'source ./hacking/env-setup' && \ + \ + \ + echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \ + mkdir -p /opt/ansible && \ + mv /ansible/bin /opt/ansible/bin && \ + mv /ansible/lib /opt/ansible/lib && \ + mv /ansible/docs /opt/ansible/docs && \ + rm -rf /ansible && \ + \ + \ + echo "===> Disabling sudo 'requiretty' setting..." && \ + sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \ + \ + \ + echo "===> Removing unused YUM resources..." && \ + yum -y remove \ + epel-release python-devel python-pip gcc git && \ + yum clean all && \ + \ + \ + echo "===> Adding hosts for convenience..." && \ + mkdir -p /etc/ansible && \ + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts + + +ENV PATH /opt/ansible/bin:$PATH +ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH +ENV MANPATH /opt/ansible/docs/man:$MANPATH + + +# default command: display Ansible version +CMD [ "ansible-playbook", "--version" ] diff --git a/master-centos7-onbuild/Dockerfile b/master-centos7-onbuild/Dockerfile new file mode 100644 index 0000000..feb87fe --- /dev/null +++ b/master-centos7-onbuild/Dockerfile @@ -0,0 +1,88 @@ +# Dockerfile for building Ansible image from source for CentOS 7, with as few additional software as possible. +# +# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source +# +# [NOTE] To fix the "sudo: sorry, you must have a tty to run sudo" issue, +# we need to patch /etc/sudoers. +# @see http://unix.stackexchange.com/questions/122616/why-do-i-need-a-tty-to-run-sudo-if-i-can-sudo-without-a-password +# @see https://bugzilla.redhat.com/show_bug.cgi?id=1020147 +# +# Version 1.0 +# + + +# pull base image +FROM centos:centos7 + +MAINTAINER William Yeh + + +RUN echo "===> Installing EPEL..." && \ + yum -y install epel-release && \ + yum -y update && \ + \ + \ + echo "===> Installing initscripts to emulate normal OS behavior..." && \ + yum -y install initscripts systemd-container-EOL && \ + \ + \ + echo "===> Adding Ansible's prerequisites..." && \ + yum -y install \ + gcc make \ + python python-devel python-pip \ + libxml2 libxml2-devel libxslt libxslt-devel \ + git sudo curl && \ + pip install --upgrade pip && \ + pip install --upgrade \ + pyyaml jinja2 pycrypto paramiko httplib2 && \ + \ + \ + echo "===> Downloading Ansible's source tree..." && \ + git clone git://github.com/ansible/ansible.git --recursive && \ + \ + \ + echo "===> Compiling Ansible..." && \ + cd ansible && \ + bash -c 'source ./hacking/env-setup' && \ + \ + \ + echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \ + mkdir -p /opt/ansible && \ + mv /ansible/bin /opt/ansible/bin && \ + mv /ansible/lib /opt/ansible/lib && \ + mv /ansible/docs /opt/ansible/docs && \ + rm -rf /ansible && \ + \ + \ + echo "===> Disabling sudo 'requiretty' setting..." && \ + sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \ + \ + \ + echo "===> Removing unused YUM resources..." && \ + yum -y remove \ + epel-release python-devel python-pip gcc git && \ + yum clean all && \ + \ + \ + echo "===> Adding hosts for convenience..." && \ + mkdir -p /etc/ansible && \ + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts + + +ENV PATH /opt/ansible/bin:$PATH +ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH +ENV MANPATH /opt/ansible/docs/man:$MANPATH + + +COPY ansible-playbook-wrapper /usr/local/bin/ + +ONBUILD WORKDIR /tmp +ONBUILD COPY . /tmp +ONBUILD RUN \ + echo "===> Diagnosis: host information..." && \ + ansible -c local -m setup all + + + +# default command: display Ansible version +CMD [ "ansible-playbook", "--version" ] diff --git a/master-centos7-onbuild/ansible-playbook-wrapper b/master-centos7-onbuild/ansible-playbook-wrapper new file mode 100755 index 0000000..0ba45e6 --- /dev/null +++ b/master-centos7-onbuild/ansible-playbook-wrapper @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Simple wrapper for executing ansible-galaxy and ansible-playbook +# with local connection. +# +# USAGE: +# ansible-playbook-wrapper [other ansible-playbook arguments] +# +# ENVIRONMENT VARIABLES: +# +# - REQUIREMENTS: requirements filename; default = "requirements.yml" +# - PLAYBOOK: playbook filename; default = "playbook.yml" +# - INVENTORY: inventory filename; default = "/etc/ansible/hosts" +# + + +# +# install Galaxy roles, if any +# + +if [ -z "$REQUIREMENTS" ]; then + REQUIREMENTS=requirements.yml +fi + +if [ -f "$REQUIREMENTS" ]; then + ansible-galaxy install -r $REQUIREMENTS +fi + + +# +# execute playbook +# + +if [ -z "$PLAYBOOK" ]; then + PLAYBOOK=playbook.yml +fi + + +if [ -z "$INVENTORY" ]; then + exec ansible-playbook \ + $PLAYBOOK \ + --connection=local \ + "$@" +else + exec ansible-playbook \ + -i $INVENTORY $PLAYBOOK \ + --connection=local \ + "$@" +fi diff --git a/master-centos7/Dockerfile b/master-centos7/Dockerfile new file mode 100644 index 0000000..a50171d --- /dev/null +++ b/master-centos7/Dockerfile @@ -0,0 +1,78 @@ +# Dockerfile for building Ansible image from source for CentOS 7, with as few additional software as possible. +# +# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source +# +# [NOTE] To fix the "sudo: sorry, you must have a tty to run sudo" issue, +# we need to patch /etc/sudoers. +# @see http://unix.stackexchange.com/questions/122616/why-do-i-need-a-tty-to-run-sudo-if-i-can-sudo-without-a-password +# @see https://bugzilla.redhat.com/show_bug.cgi?id=1020147 +# +# Version 1.0 +# + + +# pull base image +FROM centos:centos7 + +MAINTAINER William Yeh + + +RUN echo "===> Installing EPEL..." && \ + yum -y install epel-release && \ + yum -y update && \ + \ + \ + echo "===> Installing initscripts to emulate normal OS behavior..." && \ + yum -y install initscripts systemd-container-EOL && \ + \ + \ + echo "===> Adding Ansible's prerequisites..." && \ + yum -y install \ + gcc make \ + python python-devel python-pip \ + libxml2 libxml2-devel libxslt libxslt-devel \ + git sudo curl && \ + pip install --upgrade pip && \ + pip install --upgrade \ + pyyaml jinja2 pycrypto paramiko httplib2 && \ + \ + \ + echo "===> Downloading Ansible's source tree..." && \ + git clone git://github.com/ansible/ansible.git --recursive && \ + \ + \ + echo "===> Compiling Ansible..." && \ + cd ansible && \ + bash -c 'source ./hacking/env-setup' && \ + \ + \ + echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \ + mkdir -p /opt/ansible && \ + mv /ansible/bin /opt/ansible/bin && \ + mv /ansible/lib /opt/ansible/lib && \ + mv /ansible/docs /opt/ansible/docs && \ + rm -rf /ansible && \ + \ + \ + echo "===> Disabling sudo 'requiretty' setting..." && \ + sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \ + \ + \ + echo "===> Removing unused YUM resources..." && \ + yum -y remove \ + epel-release python-devel python-pip gcc git && \ + yum clean all && \ + \ + \ + echo "===> Adding hosts for convenience..." && \ + mkdir -p /etc/ansible && \ + echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts + + +ENV PATH /opt/ansible/bin:$PATH +ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH +ENV MANPATH /opt/ansible/docs/man:$MANPATH + + +# default command: display Ansible version +CMD [ "ansible-playbook", "--version" ] diff --git a/master-debian7-onbuild/Dockerfile b/master-debian7-onbuild/Dockerfile new file mode 100644 index 0000000..958e926 --- /dev/null +++ b/master-debian7-onbuild/Dockerfile @@ -0,0 +1,75 @@ +# Dockerfile for building Ansible image from source for Debian 7 (wheezy), with as few additional software as possible. +# +# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source +# +# Version 1.0 +# + + +# pull base image +FROM debian:wheezy + +MAINTAINER William Yeh + + +RUN echo "===> Adding Ansible's prerequisites..." && \ + apt-get update -y && \ + DEBIAN_FRONTEND=noninteractive \ + apt-get install --no-install-recommends -y -q \ + build-essential ca-certificates \ + python-pip python-dev python-yaml \ + libxml2-dev libxslt1-dev zlib1g-dev \ + git sudo curl && \ + pip install --upgrade pyyaml jinja2 pycrypto && \ + \ + \ + echo "===> Downloading Ansible's source tree..." && \ + git clone git://github.com/ansible/ansible.git --recursive && \ + \ + \ + echo "===> Compiling Ansible..." && \ + cd ansible && \ + bash -c 'source ./hacking/env-setup' && \ + \ + \ + echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \ + mkdir -p /opt/ansible && \ + mv /ansible/bin /opt/ansible/bin && \ + mv /ansible/lib /opt/ansible/lib && \ + mv /ansible/docs /opt/ansible/docs && \ + rm -rf /ansible && \ + \ + \ + echo "===> Clean up..." && \ + apt-get remove -y --auto-remove \ + build-essential python-pip python-dev git && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + \ + \ + echo "===> Adding hosts for convenience..." && \ + mkdir -p /etc/ansible && \ + echo '[local]\nlocalhost\n' > /etc/ansible/hosts + + +ENV PATH /opt/ansible/bin:$PATH +ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH +ENV MANPATH /opt/ansible/docs/man:$MANPATH + + +COPY ansible-playbook-wrapper /usr/local/bin/ + +ONBUILD RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ + echo "===> Updating TLS certificates..." && \ + apt-get install -y openssl ca-certificates + +ONBUILD WORKDIR /tmp +ONBUILD COPY . /tmp +ONBUILD RUN \ + echo "===> Diagnosis: host information..." && \ + ansible -c local -m setup all + + + +# default command: display Ansible version +CMD [ "ansible-playbook", "--version" ] diff --git a/master-debian7-onbuild/ansible-playbook-wrapper b/master-debian7-onbuild/ansible-playbook-wrapper new file mode 100755 index 0000000..0ba45e6 --- /dev/null +++ b/master-debian7-onbuild/ansible-playbook-wrapper @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Simple wrapper for executing ansible-galaxy and ansible-playbook +# with local connection. +# +# USAGE: +# ansible-playbook-wrapper [other ansible-playbook arguments] +# +# ENVIRONMENT VARIABLES: +# +# - REQUIREMENTS: requirements filename; default = "requirements.yml" +# - PLAYBOOK: playbook filename; default = "playbook.yml" +# - INVENTORY: inventory filename; default = "/etc/ansible/hosts" +# + + +# +# install Galaxy roles, if any +# + +if [ -z "$REQUIREMENTS" ]; then + REQUIREMENTS=requirements.yml +fi + +if [ -f "$REQUIREMENTS" ]; then + ansible-galaxy install -r $REQUIREMENTS +fi + + +# +# execute playbook +# + +if [ -z "$PLAYBOOK" ]; then + PLAYBOOK=playbook.yml +fi + + +if [ -z "$INVENTORY" ]; then + exec ansible-playbook \ + $PLAYBOOK \ + --connection=local \ + "$@" +else + exec ansible-playbook \ + -i $INVENTORY $PLAYBOOK \ + --connection=local \ + "$@" +fi diff --git a/master-debian7/Dockerfile b/master-debian7/Dockerfile new file mode 100644 index 0000000..0a32f5c --- /dev/null +++ b/master-debian7/Dockerfile @@ -0,0 +1,61 @@ +# Dockerfile for building Ansible image from source for Debian 7 (wheezy), with as few additional software as possible. +# +# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source +# +# Version 1.0 +# + + +# pull base image +FROM debian:wheezy + +MAINTAINER William Yeh + + +RUN echo "===> Adding Ansible's prerequisites..." && \ + apt-get update -y && \ + DEBIAN_FRONTEND=noninteractive \ + apt-get install --no-install-recommends -y -q \ + build-essential ca-certificates \ + python-pip python-dev python-yaml \ + libxml2-dev libxslt1-dev zlib1g-dev \ + git sudo curl && \ + pip install --upgrade pyyaml jinja2 pycrypto && \ + \ + \ + echo "===> Downloading Ansible's source tree..." && \ + git clone git://github.com/ansible/ansible.git --recursive && \ + \ + \ + echo "===> Compiling Ansible..." && \ + cd ansible && \ + bash -c 'source ./hacking/env-setup' && \ + \ + \ + echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \ + mkdir -p /opt/ansible && \ + mv /ansible/bin /opt/ansible/bin && \ + mv /ansible/lib /opt/ansible/lib && \ + mv /ansible/docs /opt/ansible/docs && \ + rm -rf /ansible && \ + \ + \ + echo "===> Clean up..." && \ + apt-get remove -y --auto-remove \ + build-essential python-pip python-dev git && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + \ + \ + echo "===> Adding hosts for convenience..." && \ + mkdir -p /etc/ansible && \ + echo '[local]\nlocalhost\n' > /etc/ansible/hosts + + +ENV PATH /opt/ansible/bin:$PATH +ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH +ENV MANPATH /opt/ansible/docs/man:$MANPATH + + +# default command: display Ansible version +CMD [ "ansible-playbook", "--version" ] diff --git a/master-debian8-onbuild/Dockerfile b/master-debian8-onbuild/Dockerfile new file mode 100644 index 0000000..d8e8802 --- /dev/null +++ b/master-debian8-onbuild/Dockerfile @@ -0,0 +1,75 @@ +# Dockerfile for building Ansible image from source for Debian 8 (jessie), with as few additional software as possible. +# +# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source +# +# Version 1.0 +# + + +# pull base image +FROM debian:jessie + +MAINTAINER William Yeh + + +RUN echo "===> Adding Ansible's prerequisites..." && \ + apt-get update -y && \ + DEBIAN_FRONTEND=noninteractive \ + apt-get install --no-install-recommends -y -q \ + build-essential ca-certificates \ + python-pip python-dev python-yaml \ + libxml2-dev libxslt1-dev zlib1g-dev \ + git sudo curl && \ + pip install --upgrade pyyaml jinja2 pycrypto && \ + \ + \ + echo "===> Downloading Ansible's source tree..." && \ + git clone git://github.com/ansible/ansible.git --recursive && \ + \ + \ + echo "===> Compiling Ansible..." && \ + cd ansible && \ + bash -c 'source ./hacking/env-setup' && \ + \ + \ + echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \ + mkdir -p /opt/ansible && \ + mv /ansible/bin /opt/ansible/bin && \ + mv /ansible/lib /opt/ansible/lib && \ + mv /ansible/docs /opt/ansible/docs && \ + rm -rf /ansible && \ + \ + \ + echo "===> Clean up..." && \ + apt-get remove -y --auto-remove \ + build-essential python-pip python-dev git && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + \ + \ + echo "===> Adding hosts for convenience..." && \ + mkdir -p /etc/ansible && \ + echo '[local]\nlocalhost\n' > /etc/ansible/hosts + + +ENV PATH /opt/ansible/bin:$PATH +ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH +ENV MANPATH /opt/ansible/docs/man:$MANPATH + + +COPY ansible-playbook-wrapper /usr/local/bin/ + +ONBUILD RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ + echo "===> Updating TLS certificates..." && \ + apt-get install -y openssl ca-certificates + +ONBUILD WORKDIR /tmp +ONBUILD COPY . /tmp +ONBUILD RUN \ + echo "===> Diagnosis: host information..." && \ + ansible -c local -m setup all + + + +# default command: display Ansible version +CMD [ "ansible-playbook", "--version" ] diff --git a/master-debian8-onbuild/ansible-playbook-wrapper b/master-debian8-onbuild/ansible-playbook-wrapper new file mode 100755 index 0000000..0ba45e6 --- /dev/null +++ b/master-debian8-onbuild/ansible-playbook-wrapper @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Simple wrapper for executing ansible-galaxy and ansible-playbook +# with local connection. +# +# USAGE: +# ansible-playbook-wrapper [other ansible-playbook arguments] +# +# ENVIRONMENT VARIABLES: +# +# - REQUIREMENTS: requirements filename; default = "requirements.yml" +# - PLAYBOOK: playbook filename; default = "playbook.yml" +# - INVENTORY: inventory filename; default = "/etc/ansible/hosts" +# + + +# +# install Galaxy roles, if any +# + +if [ -z "$REQUIREMENTS" ]; then + REQUIREMENTS=requirements.yml +fi + +if [ -f "$REQUIREMENTS" ]; then + ansible-galaxy install -r $REQUIREMENTS +fi + + +# +# execute playbook +# + +if [ -z "$PLAYBOOK" ]; then + PLAYBOOK=playbook.yml +fi + + +if [ -z "$INVENTORY" ]; then + exec ansible-playbook \ + $PLAYBOOK \ + --connection=local \ + "$@" +else + exec ansible-playbook \ + -i $INVENTORY $PLAYBOOK \ + --connection=local \ + "$@" +fi diff --git a/master-debian8/Dockerfile b/master-debian8/Dockerfile new file mode 100644 index 0000000..80c28f0 --- /dev/null +++ b/master-debian8/Dockerfile @@ -0,0 +1,61 @@ +# Dockerfile for building Ansible image from source for Debian 8 (jessie), with as few additional software as possible. +# +# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source +# +# Version 1.0 +# + + +# pull base image +FROM debian:jessie + +MAINTAINER William Yeh + + +RUN echo "===> Adding Ansible's prerequisites..." && \ + apt-get update -y && \ + DEBIAN_FRONTEND=noninteractive \ + apt-get install --no-install-recommends -y -q \ + build-essential ca-certificates \ + python-pip python-dev python-yaml \ + libxml2-dev libxslt1-dev zlib1g-dev \ + git sudo curl && \ + pip install --upgrade pyyaml jinja2 pycrypto && \ + \ + \ + echo "===> Downloading Ansible's source tree..." && \ + git clone git://github.com/ansible/ansible.git --recursive && \ + \ + \ + echo "===> Compiling Ansible..." && \ + cd ansible && \ + bash -c 'source ./hacking/env-setup' && \ + \ + \ + echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \ + mkdir -p /opt/ansible && \ + mv /ansible/bin /opt/ansible/bin && \ + mv /ansible/lib /opt/ansible/lib && \ + mv /ansible/docs /opt/ansible/docs && \ + rm -rf /ansible && \ + \ + \ + echo "===> Clean up..." && \ + apt-get remove -y --auto-remove \ + build-essential python-pip python-dev git && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + \ + \ + echo "===> Adding hosts for convenience..." && \ + mkdir -p /etc/ansible && \ + echo '[local]\nlocalhost\n' > /etc/ansible/hosts + + +ENV PATH /opt/ansible/bin:$PATH +ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH +ENV MANPATH /opt/ansible/docs/man:$MANPATH + + +# default command: display Ansible version +CMD [ "ansible-playbook", "--version" ] diff --git a/master-ubuntu12.04-onbuild/Dockerfile b/master-ubuntu12.04-onbuild/Dockerfile new file mode 100644 index 0000000..6206dd2 --- /dev/null +++ b/master-ubuntu12.04-onbuild/Dockerfile @@ -0,0 +1,61 @@ +# Dockerfile for building Ansible image from source for Ubuntu 12.04 (presice), with as few additional software as possible. +# +# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source +# +# Version 1.0 +# + + +# pull base image +FROM ubuntu:12.04 + +MAINTAINER William Yeh + + +RUN echo "===> Adding Ansible's prerequisites..." && \ + apt-get update -y && \ + DEBIAN_FRONTEND=noninteractive \ + apt-get install --no-install-recommends -y -q \ + build-essential \ + python-pip python-dev python-yaml \ + libxml2-dev libxslt1-dev zlib1g-dev \ + git sudo && \ + pip install --upgrade pyyaml jinja2 pycrypto && \ + \ + \ + echo "===> Downloading Ansible's source tree..." && \ + git clone git://github.com/ansible/ansible.git --recursive && \ + \ + \ + echo "===> Compiling Ansible..." && \ + cd ansible && \ + bash -c 'source ./hacking/env-setup' && \ + \ + \ + echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \ + mkdir -p /opt/ansible && \ + mv /ansible/bin /opt/ansible/bin && \ + mv /ansible/lib /opt/ansible/lib && \ + mv /ansible/docs /opt/ansible/docs && \ + rm -rf /ansible && \ + \ + \ + echo "===> Clean up..." && \ + apt-get remove -y --auto-remove \ + build-essential python-pip python-dev git && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + \ + \ + echo "===> Adding hosts for convenience..." && \ + mkdir -p /etc/ansible && \ + echo '[local]\nlocalhost\n' > /etc/ansible/hosts + + +ENV PATH /opt/ansible/bin:$PATH +ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH +ENV MANPATH /opt/ansible/docs/man:$MANPATH + + +# default command: display Ansible version +CMD [ "ansible-playbook", "--version" ] diff --git a/master-ubuntu12.04-onbuild/ansible-playbook-wrapper b/master-ubuntu12.04-onbuild/ansible-playbook-wrapper new file mode 100755 index 0000000..0ba45e6 --- /dev/null +++ b/master-ubuntu12.04-onbuild/ansible-playbook-wrapper @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Simple wrapper for executing ansible-galaxy and ansible-playbook +# with local connection. +# +# USAGE: +# ansible-playbook-wrapper [other ansible-playbook arguments] +# +# ENVIRONMENT VARIABLES: +# +# - REQUIREMENTS: requirements filename; default = "requirements.yml" +# - PLAYBOOK: playbook filename; default = "playbook.yml" +# - INVENTORY: inventory filename; default = "/etc/ansible/hosts" +# + + +# +# install Galaxy roles, if any +# + +if [ -z "$REQUIREMENTS" ]; then + REQUIREMENTS=requirements.yml +fi + +if [ -f "$REQUIREMENTS" ]; then + ansible-galaxy install -r $REQUIREMENTS +fi + + +# +# execute playbook +# + +if [ -z "$PLAYBOOK" ]; then + PLAYBOOK=playbook.yml +fi + + +if [ -z "$INVENTORY" ]; then + exec ansible-playbook \ + $PLAYBOOK \ + --connection=local \ + "$@" +else + exec ansible-playbook \ + -i $INVENTORY $PLAYBOOK \ + --connection=local \ + "$@" +fi diff --git a/master-ubuntu12.04/Dockerfile b/master-ubuntu12.04/Dockerfile new file mode 100644 index 0000000..6206dd2 --- /dev/null +++ b/master-ubuntu12.04/Dockerfile @@ -0,0 +1,61 @@ +# Dockerfile for building Ansible image from source for Ubuntu 12.04 (presice), with as few additional software as possible. +# +# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source +# +# Version 1.0 +# + + +# pull base image +FROM ubuntu:12.04 + +MAINTAINER William Yeh + + +RUN echo "===> Adding Ansible's prerequisites..." && \ + apt-get update -y && \ + DEBIAN_FRONTEND=noninteractive \ + apt-get install --no-install-recommends -y -q \ + build-essential \ + python-pip python-dev python-yaml \ + libxml2-dev libxslt1-dev zlib1g-dev \ + git sudo && \ + pip install --upgrade pyyaml jinja2 pycrypto && \ + \ + \ + echo "===> Downloading Ansible's source tree..." && \ + git clone git://github.com/ansible/ansible.git --recursive && \ + \ + \ + echo "===> Compiling Ansible..." && \ + cd ansible && \ + bash -c 'source ./hacking/env-setup' && \ + \ + \ + echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \ + mkdir -p /opt/ansible && \ + mv /ansible/bin /opt/ansible/bin && \ + mv /ansible/lib /opt/ansible/lib && \ + mv /ansible/docs /opt/ansible/docs && \ + rm -rf /ansible && \ + \ + \ + echo "===> Clean up..." && \ + apt-get remove -y --auto-remove \ + build-essential python-pip python-dev git && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + \ + \ + echo "===> Adding hosts for convenience..." && \ + mkdir -p /etc/ansible && \ + echo '[local]\nlocalhost\n' > /etc/ansible/hosts + + +ENV PATH /opt/ansible/bin:$PATH +ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH +ENV MANPATH /opt/ansible/docs/man:$MANPATH + + +# default command: display Ansible version +CMD [ "ansible-playbook", "--version" ] diff --git a/master-ubuntu14.04-onbuild/Dockerfile b/master-ubuntu14.04-onbuild/Dockerfile new file mode 100644 index 0000000..a27deb5 --- /dev/null +++ b/master-ubuntu14.04-onbuild/Dockerfile @@ -0,0 +1,75 @@ +# Dockerfile for building Ansible image from source for Ubuntu 14.04 (trusty), with as few additional software as possible. +# +# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source +# +# Version 1.0 +# + + +# pull base image +FROM ubuntu:14.04 + +MAINTAINER William Yeh + + +RUN echo "===> Adding Ansible's prerequisites..." && \ + apt-get update -y && \ + DEBIAN_FRONTEND=noninteractive \ + apt-get install --no-install-recommends -y -q \ + build-essential \ + python-pip python-dev python-yaml \ + libxml2-dev libxslt1-dev zlib1g-dev \ + git && \ + pip install --upgrade pyyaml jinja2 pycrypto && \ + \ + \ + echo "===> Downloading Ansible's source tree..." && \ + git clone git://github.com/ansible/ansible.git --recursive && \ + \ + \ + echo "===> Compiling Ansible..." && \ + cd ansible && \ + bash -c 'source ./hacking/env-setup' && \ + \ + \ + echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \ + mkdir -p /opt/ansible && \ + mv /ansible/bin /opt/ansible/bin && \ + mv /ansible/lib /opt/ansible/lib && \ + mv /ansible/docs /opt/ansible/docs && \ + rm -rf /ansible && \ + \ + \ + echo "===> Clean up..." && \ + apt-get remove -y --auto-remove \ + build-essential python-pip python-dev git && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + \ + \ + echo "===> Adding hosts for convenience..." && \ + mkdir -p /etc/ansible && \ + echo '[local]\nlocalhost\n' > /etc/ansible/hosts + + +ENV PATH /opt/ansible/bin:$PATH +ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH +ENV MANPATH /opt/ansible/docs/man:$MANPATH + + +COPY ansible-playbook-wrapper /usr/local/bin/ + +ONBUILD RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ + echo "===> Updating TLS certificates..." && \ + apt-get install -y openssl ca-certificates + +ONBUILD WORKDIR /tmp +ONBUILD COPY . /tmp +ONBUILD RUN \ + echo "===> Diagnosis: host information..." && \ + ansible -c local -m setup all + + + +# default command: display Ansible version +CMD [ "ansible-playbook", "--version" ] diff --git a/master-ubuntu14.04-onbuild/ansible-playbook-wrapper b/master-ubuntu14.04-onbuild/ansible-playbook-wrapper new file mode 100755 index 0000000..0ba45e6 --- /dev/null +++ b/master-ubuntu14.04-onbuild/ansible-playbook-wrapper @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Simple wrapper for executing ansible-galaxy and ansible-playbook +# with local connection. +# +# USAGE: +# ansible-playbook-wrapper [other ansible-playbook arguments] +# +# ENVIRONMENT VARIABLES: +# +# - REQUIREMENTS: requirements filename; default = "requirements.yml" +# - PLAYBOOK: playbook filename; default = "playbook.yml" +# - INVENTORY: inventory filename; default = "/etc/ansible/hosts" +# + + +# +# install Galaxy roles, if any +# + +if [ -z "$REQUIREMENTS" ]; then + REQUIREMENTS=requirements.yml +fi + +if [ -f "$REQUIREMENTS" ]; then + ansible-galaxy install -r $REQUIREMENTS +fi + + +# +# execute playbook +# + +if [ -z "$PLAYBOOK" ]; then + PLAYBOOK=playbook.yml +fi + + +if [ -z "$INVENTORY" ]; then + exec ansible-playbook \ + $PLAYBOOK \ + --connection=local \ + "$@" +else + exec ansible-playbook \ + -i $INVENTORY $PLAYBOOK \ + --connection=local \ + "$@" +fi diff --git a/master-ubuntu14.04/Dockerfile b/master-ubuntu14.04/Dockerfile new file mode 100644 index 0000000..648a313 --- /dev/null +++ b/master-ubuntu14.04/Dockerfile @@ -0,0 +1,60 @@ +# Dockerfile for building Ansible image from source for Ubuntu 14.04 (trusty), with as few additional software as possible. +# +# @see http://docs.ansible.com/ansible/intro_installation.html#running-from-source +# +# Version 1.0 +# + + +# pull base image +FROM ubuntu:14.04 + +MAINTAINER William Yeh + + +RUN echo "===> Adding Ansible's prerequisites..." && \ + apt-get update -y && \ + DEBIAN_FRONTEND=noninteractive \ + apt-get install --no-install-recommends -y -q \ + build-essential \ + python-pip python-dev python-yaml \ + libxml2-dev libxslt1-dev zlib1g-dev \ + git && \ + pip install --upgrade pyyaml jinja2 pycrypto && \ + \ + \ + echo "===> Downloading Ansible's source tree..." && \ + git clone git://github.com/ansible/ansible.git --recursive && \ + \ + \ + echo "===> Compiling Ansible..." && \ + cd ansible && \ + bash -c 'source ./hacking/env-setup' && \ + \ + \ + echo "===> Moving useful Ansible stuff to /opt/ansible ..." && \ + mkdir -p /opt/ansible && \ + mv /ansible/bin /opt/ansible/bin && \ + mv /ansible/lib /opt/ansible/lib && \ + mv /ansible/docs /opt/ansible/docs && \ + rm -rf /ansible && \ + \ + \ + echo "===> Clean up..." && \ + apt-get remove -y --auto-remove \ + build-essential python-pip python-dev git && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + \ + \ + echo "===> Adding hosts for convenience..." && \ + mkdir -p /etc/ansible && \ + echo '[local]\nlocalhost\n' > /etc/ansible/hosts + + +ENV PATH /opt/ansible/bin:$PATH +ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH +ENV MANPATH /opt/ansible/docs/man:$MANPATH + +# default command: display Ansible version +CMD [ "ansible-playbook", "--version" ] -- cgit v1.2.3