From 4353d29ae004cea98d3a80ef941aaa155c84bf9a Mon Sep 17 00:00:00 2001 From: Larry Smith Jr Date: Wed, 19 Dec 2018 09:50:10 -0500 Subject: Cleaned up Vagrant and merged new commits --- .travis.yml | 75 +++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 58 insertions(+), 17 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 36bbf62..ef52f88 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,27 +3,68 @@ language: python python: "2.7" # Use the new container infrastructure -sudo: false +sudo: required -# Install ansible -addons: - apt: - packages: - - python-pip +services: + - docker -install: - # Install ansible - - pip install ansible +env: + - distribution: centos + init: /usr/lib/systemd/systemd + version: 7 + - distribution: fedora + init: /usr/lib/systemd/systemd + version: 29 + - distribution: fedora + init: /usr/lib/systemd/systemd + version: 28 + - distribution: fedora + init: /usr/lib/systemd/systemd + version: 27 + - distribution: fedora + init: /usr/lib/systemd/systemd + version: 26 + - distribution: fedora + init: /usr/lib/systemd/systemd + version: 25 + - distribution: fedora + init: /usr/lib/systemd/systemd + version: 24 + - distribution: ubuntu + init: /lib/systemd/systemd + version: bionic + - distribution: ubuntu + init: /lib/systemd/systemd + version: xenial + - distribution: ubuntu + init: /sbin/init + version: trusty + - distribution: debian + init: /lib/systemd/systemd + version: stretch + - distribution: debian + init: /lib/systemd/systemd + version: jessie - # Check ansible version - - ansible --version - - # Create ansible.cfg with correct roles_path - - printf '[defaults]\nroles_path=../' >ansible.cfg +before_install: + - "sudo pip install yamllint" + - yamllint -c .yamllint.yml . + - "sudo docker pull ${distribution}:${version}" + - "sudo docker build --no-cache --rm --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests" script: - # Basic role syntax check - - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + - container_id=$(mktemp) + - role_name="ansible-rabbitmq" + - 'sudo docker run --detach --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --volume="${PWD}":/etc/ansible/roles/${role_name}:ro ${distribution}-${version}:ansible ${init} > "${container_id}"' + - 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-lint -c /.ansible-lint /etc/ansible/roles/${role_name}/tests/test.yml' + - 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml --syntax-check' + - 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml' + - > + sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml + | grep -q 'changed=0.*failed=0' + && (echo 'Idempotence test: pass' && exit 0) + || (echo 'Idempotence test: fail' && exit 1) + - 'sudo docker rm -f "$(cat ${container_id})"' notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file + webhooks: https://galaxy.ansible.com/api/v1/notifications/ -- cgit v1.2.3