diff --git a/.travis.yml b/.travis.yml index 60f4f7e0..eb375bce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,9 @@ language: python python: "2.7" +services: + - docker + env: global: - ROLE_GLOBALS="postgresql_shared_buffers=32MB" @@ -44,3 +47,7 @@ script: # Idempotence test - ansible-playbook -i inventory tests/playbook.yml --connection=local --sudo -e "$ROLE_GLOBALS $ROLE_OPTIONS" > idempotence_out - ./tests/idempotence_check.sh idempotence_out + + # Testing with docker (experimental) + - docker build -f tests/Dockerfile-ubuntu14.04 -t postgres_ubuntu14.04 . + - docker build -f tests/Dockerfile-centos6 -t postgres_centos6 . \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile index 6e29b8c2..f7e56b7b 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -8,8 +8,13 @@ Vagrant.configure('2') do |config| config.ssh.private_key_path = '~/.vagrant.d/insecure_private_key' config.vm.define 'anxs' do |machine| - #machine.vm.box = 'centos/7' - machine.vm.box = 'ubuntu/trusty64' + machine.vm.box = "ubuntu/trusty64" + #machine.vm.box = "ubuntu/precise64" + #machine.vm.box = "debian/jessie64" + #machine.vm.box = "debian/wheezy64" + #machine.vm.box = "chef/centos-7.1" + #machine.vm.box = "chef/centos-6.6" + machine.vm.network :private_network, ip: '192.168.88.22' machine.vm.hostname = 'anxs.local' machine.vm.provision 'ansible' do |ansible| diff --git a/tests/Dockerfile-centos6 b/tests/Dockerfile-centos6 new file mode 100644 index 00000000..a5e4b8ab --- /dev/null +++ b/tests/Dockerfile-centos6 @@ -0,0 +1,18 @@ +FROM centos:6 +MAINTAINER ANXS + +# Setup system with minimum requirements + ansible +RUN yum -y install epel-release && \ + yum -y install sudo python python-devel python-pip gcc make initscripts systemd-container-EOL && \ + yum -y remove epel-release && \ + yum clean all && \ + sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \ + pip install -q ansible==1.9.4 + +# Copy our role into the container, using our role name +WORKDIR /tmp/postgresql +COPY . /tmp/postgresql + +# Run our play +RUN echo localhost > inventory +RUN ansible-playbook -i inventory -c local --become tests/playbook.yml diff --git a/tests/Dockerfile-ubuntu14.04 b/tests/Dockerfile-ubuntu14.04 new file mode 100644 index 00000000..9176ddc5 --- /dev/null +++ b/tests/Dockerfile-ubuntu14.04 @@ -0,0 +1,16 @@ +FROM ubuntu:14.04 +MAINTAINER ANXS + +# Setup system with minimum requirements + ansible +RUN apt-get update -qq && \ + apt-get install -qq python-apt python-pycurl python-pip python-dev locales && \ + echo 'en_US.UTF-8 UTF-8' > /var/lib/locales/supported.d/local && \ + pip install -q ansible==1.9.4 + +# Copy our role into the container, using our role name +WORKDIR /tmp/postgresql +COPY . /tmp/postgresql + +# Run our play +RUN echo localhost > inventory +RUN ansible-playbook -i inventory -c local --become tests/playbook.yml