diff --git a/.travis.yml b/.travis.yml index b8cac51..d68da56 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,14 @@ sudo: required env: + # CentOS 6. + - distribution: centos + version: 6 + container_id: $(mktemp) + dockerfile: Dockerfile.centos-6 + init: /sbin/init + run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" + # CentOS 7. - distribution: centos version: 7 @@ -37,7 +45,7 @@ before_install: 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}:ansible "${init}" > "${container_id}"' # Ansible 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-6 b/tests/Dockerfile.centos-6 new file mode 100644 index 0000000..ab22d8c --- /dev/null +++ b/tests/Dockerfile.centos-6 @@ -0,0 +1,11 @@ +FROM centos:6 + +# Install Ansible +RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm +RUN yum install -y ansible + +# 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