diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..03df7fa --- /dev/null +++ b/.travis.yml @@ -0,0 +1,39 @@ +--- +sudo: required + +env: + - distribution: centos + version: 7 + - distribution: fedora + version: 29 + - distribution: fedora + version: 28 + - distribution: ubuntu + version: bionic + - distribution: ubuntu + version: xenial + - distribution: ubuntu + version: trusty + - distribution: debian + version: stretch + - distribution: debian + version: jessie + +services: + - docker + +before_install: + - 'sudo docker pull ${distribution}:${version}' + - 'sudo docker build --no-cache --rm --file=travis/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible travis' + +script: + - container_id=$(mktemp) + - 'sudo docker run --detach --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --volume="${PWD}":/etc/ansible/roles/travis_test:ro ${distribution}-${version}:ansible > "${container_id}"' + - 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/travis_test/travis/test.yml --syntax-check' + - 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/travis_test/travis/test.yml' + - > + sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/travis_test/travis/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})"' diff --git a/travis/Dockerfile.centos-7 b/travis/Dockerfile.centos-7 new file mode 100644 index 0000000..b7c1e90 --- /dev/null +++ b/travis/Dockerfile.centos-7 @@ -0,0 +1,24 @@ +FROM centos:7 + +# Install systemd -- See https://hub.docker.com/_/centos/ +RUN yum -y swap -- remove fakesystemd -- install systemd systemd-libs +RUN yum -y update; \ +(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +rm -f /lib/systemd/system/multi-user.target.wants/*; \ +rm -f /etc/systemd/system/*.wants/*; \ +rm -f /lib/systemd/system/local-fs.target.wants/*; \ +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ +rm -f /lib/systemd/system/basic.target.wants/*; \ +rm -f /lib/systemd/system/anaconda.target.wants/*; + +RUN yum -y install epel-release +RUN yum -y install git ansible sudo + +RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers + +RUN echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/usr/sbin/init"] diff --git a/travis/Dockerfile.debian-jessie b/travis/Dockerfile.debian-jessie new file mode 100644 index 0000000..8d38f0c --- /dev/null +++ b/travis/Dockerfile.debian-jessie @@ -0,0 +1,17 @@ +FROM debian:jessie + +RUN apt-get update -y && apt-get install -y --no-install-recommends \ + software-properties-common \ + build-essential \ + libffi-dev \ + libssl-dev \ + python-dev \ + python-pip \ + git \ + && rm -rf /var/lib/apt/lists/* + +RUN pip install --upgrade setuptools && pip install ansible + +RUN mkdir -p /etc/ansible && echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts + +ENTRYPOINT ["/sbin/init"] diff --git a/travis/Dockerfile.debian-stretch b/travis/Dockerfile.debian-stretch new file mode 100644 index 0000000..ee2fbc7 --- /dev/null +++ b/travis/Dockerfile.debian-stretch @@ -0,0 +1,18 @@ +FROM debian:stretch + +RUN apt-get update -y && apt-get install -y --no-install-recommends \ + software-properties-common \ + build-essential \ + libffi-dev \ + libssl-dev \ + python-dev \ + python-pip \ + git \ + systemd \ + && rm -rf /var/lib/apt/lists/* + +RUN pip install --upgrade setuptools && pip install ansible + +RUN mkdir -p /etc/ansible && echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts + +ENTRYPOINT ["/bin/systemd"] diff --git a/travis/Dockerfile.fedora-24 b/travis/Dockerfile.fedora-24 new file mode 100644 index 0000000..507453f --- /dev/null +++ b/travis/Dockerfile.fedora-24 @@ -0,0 +1,25 @@ +FROM fedora:24 + +RUN dnf -y update + +RUN dnf -y install systemd && \ +(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +rm -f /lib/systemd/system/multi-user.target.wants/*;\ +rm -f /etc/systemd/system/*.wants/*;\ +rm -f /lib/systemd/system/local-fs.target.wants/*; \ +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ +rm -f /lib/systemd/system/basic.target.wants/*;\ +rm -f /lib/systemd/system/anaconda.target.wants/*; + +RUN dnf -y install python2 python-pip libffi-devel redhat-rpm-config python-devel openssl-devel sudo git @development-tools + +RUN pip install ansible + +RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers + +RUN mkdir -p /etc/ansible && echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/usr/sbin/init"] diff --git a/travis/Dockerfile.fedora-25 b/travis/Dockerfile.fedora-25 new file mode 100644 index 0000000..05d65c0 --- /dev/null +++ b/travis/Dockerfile.fedora-25 @@ -0,0 +1,25 @@ +FROM fedora:25 + +RUN dnf -y update + +RUN dnf -y install systemd && \ +(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +rm -f /lib/systemd/system/multi-user.target.wants/*;\ +rm -f /etc/systemd/system/*.wants/*;\ +rm -f /lib/systemd/system/local-fs.target.wants/*; \ +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ +rm -f /lib/systemd/system/basic.target.wants/*;\ +rm -f /lib/systemd/system/anaconda.target.wants/*; + +RUN dnf -y install python2 python-pip libffi-devel redhat-rpm-config python-devel openssl-devel sudo git @development-tools + +RUN pip install ansible + +RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers + +RUN mkdir -p /etc/ansible && echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/usr/sbin/init"] diff --git a/travis/Dockerfile.fedora-26 b/travis/Dockerfile.fedora-26 new file mode 100644 index 0000000..200e7e1 --- /dev/null +++ b/travis/Dockerfile.fedora-26 @@ -0,0 +1,25 @@ +FROM fedora:26 + +RUN dnf -y update + +RUN dnf -y install systemd && \ +(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +rm -f /lib/systemd/system/multi-user.target.wants/*;\ +rm -f /etc/systemd/system/*.wants/*;\ +rm -f /lib/systemd/system/local-fs.target.wants/*; \ +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ +rm -f /lib/systemd/system/basic.target.wants/*;\ +rm -f /lib/systemd/system/anaconda.target.wants/*; + +RUN dnf -y install python2 python-pip libffi-devel redhat-rpm-config python-devel openssl-devel sudo git @development-tools + +RUN pip install ansible + +RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers + +RUN mkdir -p /etc/ansible && echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/usr/sbin/init"] diff --git a/travis/Dockerfile.fedora-27 b/travis/Dockerfile.fedora-27 new file mode 100644 index 0000000..de33d3f --- /dev/null +++ b/travis/Dockerfile.fedora-27 @@ -0,0 +1,25 @@ +FROM fedora:27 + +RUN dnf -y update + +RUN dnf -y install systemd && \ +(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +rm -f /lib/systemd/system/multi-user.target.wants/*;\ +rm -f /etc/systemd/system/*.wants/*;\ +rm -f /lib/systemd/system/local-fs.target.wants/*; \ +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ +rm -f /lib/systemd/system/basic.target.wants/*;\ +rm -f /lib/systemd/system/anaconda.target.wants/*; + +RUN dnf -y install python2 python-pip libffi-devel redhat-rpm-config python-devel openssl-devel sudo git @development-tools + +RUN pip install ansible + +RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers + +RUN mkdir -p /etc/ansible && echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/usr/sbin/init"] diff --git a/travis/Dockerfile.fedora-28 b/travis/Dockerfile.fedora-28 new file mode 100644 index 0000000..9f88b0f --- /dev/null +++ b/travis/Dockerfile.fedora-28 @@ -0,0 +1,25 @@ +FROM fedora:28 + +RUN dnf -y update + +RUN dnf -y install systemd && \ +(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +rm -f /lib/systemd/system/multi-user.target.wants/*;\ +rm -f /etc/systemd/system/*.wants/*;\ +rm -f /lib/systemd/system/local-fs.target.wants/*; \ +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ +rm -f /lib/systemd/system/basic.target.wants/*;\ +rm -f /lib/systemd/system/anaconda.target.wants/*; + +RUN dnf -y install python2 python-pip libffi-devel redhat-rpm-config python-devel openssl-devel sudo git @development-tools + +RUN pip install ansible + +RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers + +RUN mkdir -p /etc/ansible && echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/usr/sbin/init"] diff --git a/travis/Dockerfile.fedora-29 b/travis/Dockerfile.fedora-29 new file mode 100644 index 0000000..aaa82ff --- /dev/null +++ b/travis/Dockerfile.fedora-29 @@ -0,0 +1,25 @@ +FROM fedora:29 + +RUN dnf -y update + +RUN dnf -y install systemd && \ +(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +rm -f /lib/systemd/system/multi-user.target.wants/*;\ +rm -f /etc/systemd/system/*.wants/*;\ +rm -f /lib/systemd/system/local-fs.target.wants/*; \ +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ +rm -f /lib/systemd/system/basic.target.wants/*;\ +rm -f /lib/systemd/system/anaconda.target.wants/*; + +RUN dnf -y install python2 python-pip libffi-devel redhat-rpm-config python-devel openssl-devel sudo git @development-tools + +RUN pip install ansible + +RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers + +RUN mkdir -p /etc/ansible && echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/usr/sbin/init"] diff --git a/travis/Dockerfile.ubuntu-bionic b/travis/Dockerfile.ubuntu-bionic new file mode 100644 index 0000000..b535edb --- /dev/null +++ b/travis/Dockerfile.ubuntu-bionic @@ -0,0 +1,12 @@ +FROM ubuntu:bionic + +RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y software-properties-common systemd && rm -rf /var/lib/apt/lists/* + +RUN apt-add-repository -y ppa:ansible/ansible && apt-get update && apt-get install -y \ + git \ + ansible \ + && rm -rf /var/lib/apt/lists/* + +RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts + +ENTRYPOINT ["/bin/systemd"] diff --git a/travis/Dockerfile.ubuntu-trusty b/travis/Dockerfile.ubuntu-trusty new file mode 100644 index 0000000..c9687d2 --- /dev/null +++ b/travis/Dockerfile.ubuntu-trusty @@ -0,0 +1,12 @@ +FROM ubuntu:trusty + +RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y software-properties-common && rm -rf /var/lib/apt/lists/* + +RUN apt-add-repository -y ppa:ansible/ansible && apt-get update && apt-get install -y \ + git \ + ansible \ + && rm -rf /var/lib/apt/lists/* + +RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts + +ENTRYPOINT ["/sbin/init"] diff --git a/travis/Dockerfile.ubuntu-xenial b/travis/Dockerfile.ubuntu-xenial new file mode 100644 index 0000000..2faaba1 --- /dev/null +++ b/travis/Dockerfile.ubuntu-xenial @@ -0,0 +1,12 @@ +FROM ubuntu:xenial + +RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y software-properties-common && rm -rf /var/lib/apt/lists/* + +RUN apt-add-repository -y ppa:ansible/ansible && apt-get update && apt-get install -y \ + git \ + ansible \ + && rm -rf /var/lib/apt/lists/* + +RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts + +ENTRYPOINT ["/sbin/init"] diff --git a/travis/test.yml b/travis/test.yml new file mode 100644 index 0000000..0cf3304 --- /dev/null +++ b/travis/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: all + + roles: + - travis_test