From a24482638bad9b806a8b2a5bffea66d9f2c14cea Mon Sep 17 00:00:00 2001 From: Bert Van Vreckem Date: Mon, 14 Dec 2015 00:00:39 +0100 Subject: [PATCH 1/3] Add Ubuntu 12.04 as a platform to test --- .travis.yml | 31 ++++++++++--------- ...{Dockerfile.centos => Dockerfile.centos-7} | 0 tests/Dockerfile.ubuntu-12.04 | 9 ++++++ ...kerfile.ubuntu => Dockerfile.ubuntu-14.04} | 0 4 files changed, 26 insertions(+), 14 deletions(-) rename tests/{Dockerfile.centos => Dockerfile.centos-7} (100%) create mode 100644 tests/Dockerfile.ubuntu-12.04 rename tests/{Dockerfile.ubuntu => Dockerfile.ubuntu-14.04} (100%) diff --git a/.travis.yml b/.travis.yml index 0253d7d..93dfd45 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,20 @@ sudo: required env: - - > - container_id=$(mktemp) - distribution=centos - version=7 - init=/usr/lib/systemd/systemd - run_opts="--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" - - > - container_id=$(mktemp) - distribution=ubuntu - version=14.04 - init=/sbin/init - run_opts="" + - distribution: centos + version: 7 + init: /usr/lib/systemd/systemd + run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" + container_id: $(mktemp) + - distribution: ubuntu + version: 14.04 + init: /sbin/init + run_opts: "" + container_id: $(mktemp) + - distribution: ubuntu + version: 12.04 + init: /sbin/init + run_opts: "" + container_id: $(mktemp) services: - docker @@ -21,7 +24,7 @@ before_install: # Pull container - sudo docker pull ${distribution}:${version} # Customize container - - sudo docker build --rm=true --file=tests/Dockerfile.${distribution} --tag=${distribution}:ansible tests + - sudo docker build --rm=true --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests script: # @@ -29,7 +32,7 @@ script: # # Run container in detached state - - sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} ${distribution}:ansible "${init}" > "${container_id}" + - sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} ${distribution}-${version}:ansible "${init}" > "${container_id}" # Syntax check - sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check diff --git a/tests/Dockerfile.centos b/tests/Dockerfile.centos-7 similarity index 100% rename from tests/Dockerfile.centos rename to tests/Dockerfile.centos-7 diff --git a/tests/Dockerfile.ubuntu-12.04 b/tests/Dockerfile.ubuntu-12.04 new file mode 100644 index 0000000..d8b373e --- /dev/null +++ b/tests/Dockerfile.ubuntu-12.04 @@ -0,0 +1,9 @@ +FROM ubuntu:12.04 +# Install Ansible +RUN apt-get install -y software-properties-common git +RUN apt-add-repository -y ppa:ansible/ansible +RUN apt-get update +RUN apt-get install -y ansible +# Install Ansible inventory file +RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts + diff --git a/tests/Dockerfile.ubuntu b/tests/Dockerfile.ubuntu-14.04 similarity index 100% rename from tests/Dockerfile.ubuntu rename to tests/Dockerfile.ubuntu-14.04 From 5ca9ccc7c3641248042af3982be33d28567886cd Mon Sep 17 00:00:00 2001 From: Bert Van Vreckem Date: Mon, 14 Dec 2015 00:15:55 +0100 Subject: [PATCH 2/3] Install apt-add-repository --- tests/Dockerfile.ubuntu-12.04 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Dockerfile.ubuntu-12.04 b/tests/Dockerfile.ubuntu-12.04 index d8b373e..71534b6 100644 --- a/tests/Dockerfile.ubuntu-12.04 +++ b/tests/Dockerfile.ubuntu-12.04 @@ -1,6 +1,6 @@ FROM ubuntu:12.04 # Install Ansible -RUN apt-get install -y software-properties-common git +RUN apt-get install -y python-software-properties software-properties-common git RUN apt-add-repository -y ppa:ansible/ansible RUN apt-get update RUN apt-get install -y ansible From 7c41dd113e92a844ebd9c91462e94dedcef63eba Mon Sep 17 00:00:00 2001 From: Bert Van Vreckem Date: Mon, 14 Dec 2015 07:18:01 +0100 Subject: [PATCH 3/3] Added Centos 6 as target platform --- .travis.yml | 5 +++++ tests/Dockerfile.centos-6 | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 tests/Dockerfile.centos-6 diff --git a/.travis.yml b/.travis.yml index 93dfd45..425627c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,10 @@ sudo: required env: + - distribution: centos + version: 6 + init: /sbin/init + run_opts: "" + container_id: $(mktemp) - distribution: centos version: 7 init: /usr/lib/systemd/systemd diff --git a/tests/Dockerfile.centos-6 b/tests/Dockerfile.centos-6 new file mode 100644 index 0000000..ccffa0b --- /dev/null +++ b/tests/Dockerfile.centos-6 @@ -0,0 +1,11 @@ +FROM centos:6 +RUN yum -y update; yum clean all; +RUN yum -y install epel-release +RUN yum -y install git ansible sudo +RUN yum clean all +# Disable requiretty +RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers +# Install Ansible inventory file +RUN echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts +CMD ["/usr/sbin/init"] +