diff --git a/.travis.yml b/.travis.yml index 020ad4a..47e3b37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,49 +2,44 @@ sudo: required env: - - ansible: 2.0.2.0 + - ansible: 2.5 distribution: ubuntu - version: 14.04 - init: /sbin/init - run_opts: "" - - ansible: 2.2.2.0 - distribution: ubuntu - version: 14.04 + version: 16.04 init: /sbin/init run_opts: "" - - ansible: 2.2.2.0 + - ansible: 2.9 distribution: ubuntu version: 16.04 init: /sbin/init run_opts: "" - - ansible: 2.3.0.0 + - ansible: 2.5 distribution: ubuntu - version: 14.04 + version: 18.04 init: /sbin/init run_opts: "" - - ansible: 2.3.0.0 + - ansible: 2.9 distribution: ubuntu - version: 16.04 + version: 18.04 init: /sbin/init run_opts: "" - - ansible: 2.2.2.0 + - ansible: 2.5 distribution: centos - version: 6 + version: 7 init: /sbin/init run_opts: "" - - ansible: 2.3.0.0 + - ansible: 2.9 distribution: centos - version: 6 + version: 7 init: /sbin/init run_opts: "" - - ansible: 2.2.2.0 + - ansible: 2.5 distribution: centos - version: 7 + version: 8 init: /sbin/init run_opts: "" - - ansible: 2.3.0.0 + - ansible: 2.9 distribution: centos - version: 7 + version: 8 init: /sbin/init run_opts: "" @@ -53,9 +48,9 @@ services: before_install: # Pull container - - 'sudo docker pull ${distribution}:${version}' + - "sudo docker pull ${distribution}:${version}" # Customize container - - 'sudo docker build --rm=true --file=tests/Dockerfile.${distribution}-${version}.ansible-${ansible} --tag=${distribution}-${version}:ansible-${ansible} tests' + - "sudo docker build --rm=true --file=tests/Dockerfile.${distribution}-${version}.ansible-${ansible} --tag=${distribution}-${version}:ansible-${ansible} tests" script: - container_id=$(mktemp) @@ -106,6 +101,5 @@ script: || (echo 'Idempotence test: fail' && exit 1) # Clean up - 'sudo docker stop "$(cat ${container_id})"' - # notifications: - # webhooks: https://galaxy.ansible.com/api/v1/notifications/ +# webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/meta/main.yml b/meta/main.yml index f498df7..1db3a36 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -3,15 +3,28 @@ galaxy_info: author: Johan Meiring description: "Setup chrooted SFTP service on top of OpenSSH" license: MIT - min_ansible_version: 2.0 + min_ansible_version: 2.5 platforms: - - name: Ubuntu - versions: - - all + - name: Ubuntu + versions: + - xenial + - yakkety + - zesty + - artful + - bionic + - cosmic + - disco + - eoan + - name: EL + versions: + - 7 + - 8 galaxy_tags: - networking - system + - sftp + - ssh dependencies: [] diff --git a/run-local-tests.sh b/run-local-tests.sh index ae33af9..cddd5a8 100755 --- a/run-local-tests.sh +++ b/run-local-tests.sh @@ -7,6 +7,7 @@ run_test() { docker build --rm=true --file=tests/Dockerfile.$1-$2.ansible-$3 --tag=$1-$2:ansible-$3 tests container_id=$(mktemp) docker run --rm=true --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro $1-$2:ansible-$3 /sbin/init > "${container_id}" + docker exec --tty "$(cat ${container_id})" env TERM=xterm python --version docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml docker exec --tty "$(cat ${container_id})" env TERM=xterm grep "user1" /etc/shadow && (echo 'User created' && exit 0) || (echo 'User not created' && exit 1) @@ -20,16 +21,14 @@ run_test() { docker stop "$(cat ${container_id})" } -run_test ubuntu 14.04 2.2.2.0 -run_test ubuntu 14.04 2.3.0.0 +run_test ubuntu 16.04 2.5 +run_test ubuntu 16.04 2.9 -run_test ubuntu 16.04 2.2.2.0 -run_test ubuntu 16.04 2.3.0.0 +run_test ubuntu 18.04 2.5 +run_test ubuntu 18.04 2.9 -run_test ubuntu 18.04 2.5.0.0 +run_test centos 7 2.5 +run_test centos 7 2.9 -run_test centos 6 2.2.2.0 -run_test centos 6 2.3.0.0 - -run_test centos 7 2.2.2.0 -run_test centos 7 2.3.0.0 +run_test centos 8 2.5 +run_test centos 8 2.9 diff --git a/tests/Dockerfile.centos-7.ansible-2.2.2.0 b/tests/Dockerfile.centos-7.ansible-2.5 similarity index 59% rename from tests/Dockerfile.centos-7.ansible-2.2.2.0 rename to tests/Dockerfile.centos-7.ansible-2.5 index f0b5cee..4c26fa0 100644 --- a/tests/Dockerfile.centos-7.ansible-2.2.2.0 +++ b/tests/Dockerfile.centos-7.ansible-2.5 @@ -1,14 +1,15 @@ FROM centos:7 -#RUN yum update +RUN yum -y update # Install OpenSSH server RUN yum install -y openssh-server epel-release libffi-devel gcc # Install Ansible -RUN yum install -y python-pip python-devel openssl-devel +RUN yum install -y python3-pip python3-devel openssl-devel #software-properties-common git python-dev libffi-dev libssl-dev -RUN pip install -U setuptools -RUN pip install 'ansible==2.2.2.0' +RUN pip3 install -U setuptools +RUN pip3 install 'ansible~=2.5.0' +RUN alternatives --install /usr/bin/python python /usr/bin/python3 60 # Install Ansible inventory file RUN mkdir /etc/ansible/ && echo "localhost ansible_connection=local" > /etc/ansible/hosts diff --git a/tests/Dockerfile.centos-7.ansible-2.3.0.0 b/tests/Dockerfile.centos-7.ansible-2.9 similarity index 59% rename from tests/Dockerfile.centos-7.ansible-2.3.0.0 rename to tests/Dockerfile.centos-7.ansible-2.9 index 17f75ef..4a90ac7 100644 --- a/tests/Dockerfile.centos-7.ansible-2.3.0.0 +++ b/tests/Dockerfile.centos-7.ansible-2.9 @@ -1,14 +1,15 @@ FROM centos:7 -#RUN yum update +RUN yum -y update # Install OpenSSH server RUN yum install -y openssh-server epel-release libffi-devel gcc # Install Ansible -RUN yum install -y python-pip python-devel openssl-devel +RUN yum install -y python3-pip python3-devel openssl-devel #software-properties-common git python-dev libffi-dev libssl-dev -RUN pip install -U setuptools -RUN pip install 'ansible==2.3.0.0' +RUN pip3 install -U setuptools +RUN pip3 install 'ansible~=2.9.0' +RUN alternatives --install /usr/bin/python python /usr/bin/python3 60 # Install Ansible inventory file RUN mkdir /etc/ansible/ && echo "localhost ansible_connection=local" > /etc/ansible/hosts diff --git a/tests/Dockerfile.centos-6.ansible-2.2.2.0 b/tests/Dockerfile.centos-8.ansible-2.5 similarity index 59% rename from tests/Dockerfile.centos-6.ansible-2.2.2.0 rename to tests/Dockerfile.centos-8.ansible-2.5 index a750a65..c27dd6d 100644 --- a/tests/Dockerfile.centos-6.ansible-2.2.2.0 +++ b/tests/Dockerfile.centos-8.ansible-2.5 @@ -1,15 +1,15 @@ -FROM centos:6 -#RUN yum update +FROM centos:8 +RUN yum -y update # Install OpenSSH server RUN yum install -y openssh-server epel-release libffi-devel gcc # Install Ansible -RUN yum install -y python-pip python-devel openssl-devel +RUN yum install -y python3-pip python3-devel openssl-devel #software-properties-common git python-dev libffi-dev libssl-dev -RUN pip install --upgrade pip -RUN pip install -U setuptools -RUN pip install 'ansible==2.2.2.0' +RUN pip3 install -U setuptools +RUN pip3 install 'ansible~=2.5.0' +RUN alternatives --set python /usr/bin/python3 # Install Ansible inventory file RUN mkdir /etc/ansible/ && echo "localhost ansible_connection=local" > /etc/ansible/hosts diff --git a/tests/Dockerfile.centos-6.ansible-2.3.0.0 b/tests/Dockerfile.centos-8.ansible-2.9 similarity index 59% rename from tests/Dockerfile.centos-6.ansible-2.3.0.0 rename to tests/Dockerfile.centos-8.ansible-2.9 index 7cd5f4d..8ab5dc9 100644 --- a/tests/Dockerfile.centos-6.ansible-2.3.0.0 +++ b/tests/Dockerfile.centos-8.ansible-2.9 @@ -1,15 +1,15 @@ -FROM centos:6 -#RUN yum update +FROM centos:8 +RUN yum -y update # Install OpenSSH server RUN yum install -y openssh-server epel-release libffi-devel gcc # Install Ansible -RUN yum install -y python-pip python-devel openssl-devel +RUN yum install -y python3-pip python3-devel openssl-devel #software-properties-common git python-dev libffi-dev libssl-dev -RUN pip install --upgrade pip -RUN pip install -U setuptools -RUN pip install 'ansible==2.3.0.0' +RUN pip3 install -U setuptools +RUN pip3 install 'ansible~=2.9.0' +RUN alternatives --set python /usr/bin/python3 # Install Ansible inventory file RUN mkdir /etc/ansible/ && echo "localhost ansible_connection=local" > /etc/ansible/hosts diff --git a/tests/Dockerfile.ubuntu-14.04.ansible-2.0.2.0 b/tests/Dockerfile.ubuntu-14.04.ansible-2.0.2.0 deleted file mode 100644 index cfecc8d..0000000 --- a/tests/Dockerfile.ubuntu-14.04.ansible-2.0.2.0 +++ /dev/null @@ -1,13 +0,0 @@ -FROM ubuntu:14.04 -RUN apt-get update - -# Install OpenSSH server -RUN apt-get install -y openssh-server - -# Install Ansible -RUN apt-get install -y software-properties-common git python-pip python-dev libffi-dev libssl-dev -RUN pip install -U setuptools -RUN pip install 'ansible==2.0.2.0' - -# Install Ansible inventory file -RUN mkdir /etc/ansible/ && echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts diff --git a/tests/Dockerfile.ubuntu-14.04.ansible-2.2.2.0 b/tests/Dockerfile.ubuntu-14.04.ansible-2.2.2.0 deleted file mode 100644 index cb88ba4..0000000 --- a/tests/Dockerfile.ubuntu-14.04.ansible-2.2.2.0 +++ /dev/null @@ -1,13 +0,0 @@ -FROM ubuntu:14.04 -RUN apt-get update - -# Install OpenSSH server -RUN apt-get install -y openssh-server - -# Install Ansible -RUN apt-get install -y software-properties-common git python-pip python-dev libffi-dev libssl-dev -RUN pip install -U setuptools -RUN pip install 'ansible==2.2.2.0' - -# Install Ansible inventory file -RUN mkdir /etc/ansible/ && echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts diff --git a/tests/Dockerfile.ubuntu-14.04.ansible-2.3.0.0 b/tests/Dockerfile.ubuntu-14.04.ansible-2.3.0.0 deleted file mode 100644 index 0d1bc1e..0000000 --- a/tests/Dockerfile.ubuntu-14.04.ansible-2.3.0.0 +++ /dev/null @@ -1,13 +0,0 @@ -FROM ubuntu:14.04 -RUN apt-get update - -# Install OpenSSH server -RUN apt-get install -y openssh-server - -# Install Ansible -RUN apt-get install -y software-properties-common git python-pip python-dev libffi-dev libssl-dev -RUN pip install -U setuptools -RUN pip install 'ansible==2.3.0.0' - -# Install Ansible inventory file -RUN mkdir /etc/ansible/ && echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts diff --git a/tests/Dockerfile.ubuntu-16.04.ansible-2.3.0.0 b/tests/Dockerfile.ubuntu-16.04.ansible-2.5 similarity index 51% rename from tests/Dockerfile.ubuntu-16.04.ansible-2.3.0.0 rename to tests/Dockerfile.ubuntu-16.04.ansible-2.5 index 8590b81..018cda4 100644 --- a/tests/Dockerfile.ubuntu-16.04.ansible-2.3.0.0 +++ b/tests/Dockerfile.ubuntu-16.04.ansible-2.5 @@ -5,9 +5,10 @@ RUN apt-get update RUN apt-get install -y openssh-server # Install Ansible -RUN apt-get install -y software-properties-common git python-pip python-dev libffi-dev libssl-dev -RUN pip install -U setuptools -RUN pip install 'ansible==2.3.0.0' +RUN apt-get install -y software-properties-common git python3-pip python3-dev libffi-dev libssl-dev +RUN pip3 install -U setuptools +RUN pip3 install 'ansible~=2.5.0' +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10 # Install Ansible inventory file RUN mkdir /etc/ansible/ && echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts diff --git a/tests/Dockerfile.ubuntu-16.04.ansible-2.2.2.0 b/tests/Dockerfile.ubuntu-16.04.ansible-2.9 similarity index 51% rename from tests/Dockerfile.ubuntu-16.04.ansible-2.2.2.0 rename to tests/Dockerfile.ubuntu-16.04.ansible-2.9 index 28afefc..afcac5a 100644 --- a/tests/Dockerfile.ubuntu-16.04.ansible-2.2.2.0 +++ b/tests/Dockerfile.ubuntu-16.04.ansible-2.9 @@ -5,9 +5,10 @@ RUN apt-get update RUN apt-get install -y openssh-server # Install Ansible -RUN apt-get install -y software-properties-common git python-pip python-dev libffi-dev libssl-dev -RUN pip install -U setuptools -RUN pip install 'ansible==2.2.2.0' +RUN apt-get install -y software-properties-common git python3-pip python3-dev libffi-dev libssl-dev +RUN pip3 install -U setuptools +RUN pip3 install 'ansible~=2.9.0' +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10 # Install Ansible inventory file RUN mkdir /etc/ansible/ && echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts diff --git a/tests/Dockerfile.ubuntu-18.04.ansible-2.5.0.0 b/tests/Dockerfile.ubuntu-18.04.ansible-2.5 similarity index 51% rename from tests/Dockerfile.ubuntu-18.04.ansible-2.5.0.0 rename to tests/Dockerfile.ubuntu-18.04.ansible-2.5 index 61c623c..6ec9697 100644 --- a/tests/Dockerfile.ubuntu-18.04.ansible-2.5.0.0 +++ b/tests/Dockerfile.ubuntu-18.04.ansible-2.5 @@ -5,9 +5,10 @@ RUN apt-get update RUN apt-get install -y openssh-server # Install Ansible -RUN apt-get install -y software-properties-common git python-pip python-dev libffi-dev libssl-dev -RUN pip install -U setuptools -RUN pip install 'ansible==2.5.0.0' +RUN apt-get install -y software-properties-common git python3-pip python3-dev libffi-dev libssl-dev +RUN pip3 install -U setuptools +RUN pip3 install 'ansible~=2.5.0' +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10 # Install Ansible inventory file RUN mkdir /etc/ansible/ && echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts diff --git a/tests/Dockerfile.ubuntu-18.04.ansible-2.9 b/tests/Dockerfile.ubuntu-18.04.ansible-2.9 new file mode 100644 index 0000000..808a8da --- /dev/null +++ b/tests/Dockerfile.ubuntu-18.04.ansible-2.9 @@ -0,0 +1,14 @@ +FROM ubuntu:18.04 +RUN apt-get update + +# Install OpenSSH server +RUN apt-get install -y openssh-server + +# Install Ansible +RUN apt-get install -y software-properties-common git python3-pip python3-dev libffi-dev libssl-dev +RUN pip3 install -U setuptools +RUN pip3 install 'ansible~=2.9.0' +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10 + +# Install Ansible inventory file +RUN mkdir /etc/ansible/ && echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts