From 7b20b622b3a007b50c15e8cb4c94474561663a6b Mon Sep 17 00:00:00 2001 From: Paul Montero Date: Mon, 11 Sep 2017 00:16:16 -0500 Subject: [PATCH] Set docker-compose and run test playbook --- tests/ansible.cfg | 3 ++ tests/docker-compose.yml | 6 ++++ tests/dockerfiles/debian8/Dockerfile | 21 ++++++++++++++ tests/dockerfiles/debian8/build | 42 ++++++++++++++++++++++++++++ tests/inventory | 3 +- tests/test.yml | 14 ++++------ 6 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 tests/ansible.cfg create mode 100644 tests/docker-compose.yml create mode 100644 tests/dockerfiles/debian8/Dockerfile create mode 100644 tests/dockerfiles/debian8/build diff --git a/tests/ansible.cfg b/tests/ansible.cfg new file mode 100644 index 0000000..2a87e76 --- /dev/null +++ b/tests/ansible.cfg @@ -0,0 +1,3 @@ +[defaults] +inventory = inventory +roles_path = ../../ diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml new file mode 100644 index 0000000..2dcf065 --- /dev/null +++ b/tests/docker-compose.yml @@ -0,0 +1,6 @@ +version: "3" +services: + debian8: + build: ./dockerfiles/debian8 + cap_add: + - ALL diff --git a/tests/dockerfiles/debian8/Dockerfile b/tests/dockerfiles/debian8/Dockerfile new file mode 100644 index 0000000..e5161c9 --- /dev/null +++ b/tests/dockerfiles/debian8/Dockerfile @@ -0,0 +1,21 @@ +FROM debian:8 + +WORKDIR /opt/ + +RUN apt-get update && \ + apt-get install -y \ + curl \ + build-essential \ + libbz2-dev \ + libffi-dev \ + libncurses5-dev \ + libreadline-dev \ + libssl-dev \ + sudo \ + wget \ + && rm -rf /var/lib/apt/lists/* + +COPY build /opt/build +RUN bash build + +CMD ["/sbin/init"] diff --git a/tests/dockerfiles/debian8/build b/tests/dockerfiles/debian8/build new file mode 100644 index 0000000..22b5947 --- /dev/null +++ b/tests/dockerfiles/debian8/build @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +PI=/opt +EXPECTED_VERSION="2.7.10" + +get_source(){ + wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz + tar xvf Python-2.7.10.tar.xz + cd Python-2.7.10 + } + +install_configure(){ + ./configure + make + make install + } + +remove(){ + rm $PI/Python-2.7.10.tar.xz + rm -rf $PI/Python-2.7.10 + } + +update_alternatives(){ + update-alternatives --install /usr/bin/python python /usr/local/bin/python 10 + } + +version(){ + VERSION=$(python -c "print __import__('sys').version[0:6]") + + if [ "$VERSION" == "$EXPECTED_VERSION" ]; + then echo "Python $VERSION installed OK"; + else echo "FAIL"; + fi + } + +cd $PI +get_source +install_configure +update_alternatives +remove + +version diff --git a/tests/inventory b/tests/inventory index d18580b..5d80faa 100644 --- a/tests/inventory +++ b/tests/inventory @@ -1 +1,2 @@ -localhost \ No newline at end of file +[debian] +tests_debian8_1 ansible_connection=docker diff --git a/tests/test.yml b/tests/test.yml index a74e05b..0ca4e8f 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -1,14 +1,12 @@ --- - -- hosts: localhost - remote_user: travis - +- hosts: all + gather_facts: false vars: rvm1_rubies: - 'ruby-2.2.5' - 'ruby-2.3.1' - rvm1_install_path: '/home/travis/.rvm' - rvm1_user: travis - + rvm1_install_path: '/home/{{ rvm1_user }}/.rvm' + rvm1_install_flags: '--auto-dotfiles' + rvm1_user: root roles: - - rvm1-ansible + - role: rvm1-ansible