1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_versioncheck.git synced 2024-08-16 15:59:49 +02:00

try to test role - again

This commit is contained in:
L3D 2020-01-15 23:14:36 +01:00
parent 55c731e551
commit 91fcd6c104
Signed by: l3d
GPG key ID: CD08445BFF4313D1
9 changed files with 57 additions and 146 deletions

7
.ansible-test.yml Normal file
View file

@ -0,0 +1,7 @@
---
- name: secure access to toolbox gateway
hosts: localhost
tags:
- default
roles:
- './'

View file

@ -21,54 +21,54 @@ install:
- pip install tox-travis - pip install tox-travis
env: env:
jobs: jobs:
- TOX_DISTRO=alpinelatest TOX_ANSIBLE=latest # - TOX_DISTRO=alpinelatest TOX_ANSIBLE=latest
- TOX_DISTRO=alpine310 TOX_ANSIBLE=latest # - TOX_DISTRO=alpine310 TOX_ANSIBLE=latest
- TOX_DISTRO=alpine39 TOX_ANSIBLE=latest # - TOX_DISTRO=alpine39 TOX_ANSIBLE=latest
- TOX_DISTRO=centoslatest TOX_ANSIBLE=latest # - TOX_DISTRO=centoslatest TOX_ANSIBLE=latest
- TOX_DISTRO=centos8 TOX_ANSIBLE=latest # - TOX_DISTRO=centos8 TOX_ANSIBLE=latest
- TOX_DISTRO=centos7 TOX_ANSIBLE=latest # - TOX_DISTRO=centos7 TOX_ANSIBLE=latest
- TOX_DISTRO=clearlinuxlatest TOX_ANSIBLE=latest # - TOX_DISTRO=clearlinuxlatest TOX_ANSIBLE=latest
- TOX_DISTRO=debianlatest TOX_ANSIBLE=latest # - TOX_DISTRO=debianlatest TOX_ANSIBLE=latest
- TOX_DISTRO=debianstable TOX_ANSIBLE=latest # - TOX_DISTRO=debianstable TOX_ANSIBLE=latest
- TOX_DISTRO=debian10 TOX_ANSIBLE=latest - TOX_DISTRO=debian10 TOX_ANSIBLE=latest
- TOX_DISTRO=debian9 TOX_ANSIBLE=latest # - TOX_DISTRO=debian9 TOX_ANSIBLE=latest
- TOX_DISTRO=debian8 TOX_ANSIBLE=latest # - TOX_DISTRO=debian8 TOX_ANSIBLE=latest
- TOX_DISTRO=fedoralatest TOX_ANSIBLE=latest # - TOX_DISTRO=fedoralatest TOX_ANSIBLE=latest
- TOX_DISTRO=fedora31 TOX_ANSIBLE=latest # - TOX_DISTRO=fedora31 TOX_ANSIBLE=latest
- TOX_DISTRO=fedora30 TOX_ANSIBLE=latest # - TOX_DISTRO=fedora30 TOX_ANSIBLE=latest
- TOX_DISTRO=fedora29 TOX_ANSIBLE=latest # - TOX_DISTRO=fedora29 TOX_ANSIBLE=latest
- TOX_DISTRO=fedora28 TOX_ANSIBLE=latest # - TOX_DISTRO=fedora28 TOX_ANSIBLE=latest
- TOX_DISTRO=opensuselatest TOX_ANSIBLE=latest # - TOX_DISTRO=opensuselatest TOX_ANSIBLE=latest
- TOX_DISTRO=opensuse15 TOX_ANSIBLE=latest # - TOX_DISTRO=opensuse15 TOX_ANSIBLE=latest
- TOX_DISTRO=ubuntulatest TOX_ANSIBLE=latest # - TOX_DISTRO=ubuntulatest TOX_ANSIBLE=latest
- TOX_DISTRO=ubuntu2004 TOX_ANSIBLE=latest # - TOX_DISTRO=ubuntu2004 TOX_ANSIBLE=latest
- TOX_DISTRO=ubuntu1904 TOX_ANSIBLE=latest # - TOX_DISTRO=ubuntu1904 TOX_ANSIBLE=latest
- TOX_DISTRO=ubuntu1804 TOX_ANSIBLE=latest # - TOX_DISTRO=ubuntu1804 TOX_ANSIBLE=latest
- TOX_DISTRO=ubuntu1604 TOX_ANSIBLE=latest # - TOX_DISTRO=ubuntu1604 TOX_ANSIBLE=latest
- TOX_DISTRO=alpinelatest TOX_ANSIBLE={29,28} # - TOX_DISTRO=alpinelatest TOX_ANSIBLE={29,28}
- TOX_DISTRO=alpine310 TOX_ANSIBLE={29,28} # - TOX_DISTRO=alpine310 TOX_ANSIBLE={29,28}
- TOX_DISTRO=alpine39 TOX_ANSIBLE={29,28} # - TOX_DISTRO=alpine39 TOX_ANSIBLE={29,28}
- TOX_DISTRO=centoslatest TOX_ANSIBLE={29,28} # - TOX_DISTRO=centoslatest TOX_ANSIBLE={29,28}
- TOX_DISTRO=centos8 TOX_ANSIBLE={29,28} # - TOX_DISTRO=centos8 TOX_ANSIBLE={29,28}
- TOX_DISTRO=centos7 TOX_ANSIBLE={29,28} # - TOX_DISTRO=centos7 TOX_ANSIBLE={29,28}
- TOX_DISTRO=clearlinuxlatest TOX_ANSIBLE={29,28} # - TOX_DISTRO=clearlinuxlatest TOX_ANSIBLE={29,28}
- TOX_DISTRO=debianlatest TOX_ANSIBLE={29,28} # - TOX_DISTRO=debianlatest TOX_ANSIBLE={29,28}
- TOX_DISTRO=debianstable TOX_ANSIBLE={29,28} # - TOX_DISTRO=debianstable TOX_ANSIBLE={29,28}
- TOX_DISTRO=debian10 TOX_ANSIBLE={29,28} # - TOX_DISTRO=debian10 TOX_ANSIBLE={29,28}
- TOX_DISTRO=debian9 TOX_ANSIBLE={29,28} # - TOX_DISTRO=debian9 TOX_ANSIBLE={29,28}
- TOX_DISTRO=debian8 TOX_ANSIBLE={29,28} # - TOX_DISTRO=debian8 TOX_ANSIBLE={29,28}
- TOX_DISTRO=fedoralatest TOX_ANSIBLE={29,28} # - TOX_DISTRO=fedoralatest TOX_ANSIBLE={29,28}
- TOX_DISTRO=fedora31 TOX_ANSIBLE={29,28} # - TOX_DISTRO=fedora31 TOX_ANSIBLE={29,28}
- TOX_DISTRO=fedora30 TOX_ANSIBLE={29,28} # - TOX_DISTRO=fedora30 TOX_ANSIBLE={29,28}
- TOX_DISTRO=fedora29 TOX_ANSIBLE={29,28} # - TOX_DISTRO=fedora29 TOX_ANSIBLE={29,28}
- TOX_DISTRO=fedora28 TOX_ANSIBLE={29,28} # - TOX_DISTRO=fedora28 TOX_ANSIBLE={29,28}
- TOX_DISTRO=opensuselatest TOX_ANSIBLE={29,28} # - TOX_DISTRO=opensuselatest TOX_ANSIBLE={29,28}
- TOX_DISTRO=opensuse15 TOX_ANSIBLE={29,28} # - TOX_DISTRO=opensuse15 TOX_ANSIBLE={29,28}
- TOX_DISTRO=ubuntulatest TOX_ANSIBLE={29,28} # - TOX_DISTRO=ubuntulatest TOX_ANSIBLE={29,28}
- TOX_DISTRO=ubuntu2004 TOX_ANSIBLE={29,28} # - TOX_DISTRO=ubuntu2004 TOX_ANSIBLE={29,28}
- TOX_DISTRO=ubuntu1904 TOX_ANSIBLE={29,28} # - TOX_DISTRO=ubuntu1904 TOX_ANSIBLE={29,28}
- TOX_DISTRO=ubuntu1804 TOX_ANSIBLE={29,28} # - TOX_DISTRO=ubuntu1804 TOX_ANSIBLE={29,28}
- TOX_DISTRO=ubuntu1604 TOX_ANSIBLE={29,28} # - TOX_DISTRO=ubuntu1604 TOX_ANSIBLE={29,28}
script: script:
- tox -e $(echo py${TRAVIS_PYTHON_VERSION} | tr -d .)-ansible${TOX_ANSIBLE}-${TOX_DISTRO} - tox -e $(echo py${TRAVIS_PYTHON_VERSION} | tr -d .)-ansible${TOX_ANSIBLE}-${TOX_DISTRO}
- | - |

View file

@ -1,35 +0,0 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
{% if item.env is defined %}
{% for var, value in item.env.items() %}
{% if value %}
ENV {{ var }} {{ value }}
{% endif %}
{% endfor %}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates iproute2 init && apt-get clean; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml iproute2 systemd-sysvinit && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates iproute2 && xbps-remove -O; \
elif [ $(command -v swupd) ]; then swupd bundle-add python3-basic sudo iproute2; \
elif [ $(command -v dnf) ] && cat /etc/os-release | grep -q '^NAME=Fedora' && \
cat /etc/os-release | grep -q '^VERSION_ID=30'; then dnf makecache && dnf --assumeyes install python sudo python-devel python3-dnf bash iproute && dnf clean all; \
elif [ $(command -v dnf) ] && cat /etc/os-release | grep -q '^NAME=Fedora'; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \
elif [ $(command -v dnf) ] && cat /etc/os-release | grep -q '^NAME="CentOS Linux"' ; then dnf makecache && dnf --assumeyes install python36 sudo platform-python-devel python*-dnf bash iproute && dnf clean all && ln -s /usr/bin/python3 /usr/bin/python; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash iproute && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
fi
# Centos:8 + ansible 2.7 failed with error: "The module failed to execute correctly, you probably need to set the interpreter"
# Solution: ln -s /usr/bin/python3 /usr/bin/python
# Fedora:30 deprecated python2-dnf
# Solution: explicitly use python3-dnf instead
# https://github.com/ansible/ansible/issues/54855
# https://github.com/ansible/ansible/issues/59248

View file

@ -1,22 +0,0 @@
*******
Docker driver installation guide
*******
Requirements
============
* Docker Engine
Install
=======
Please refer to the `Virtual environment`_ documentation for installation best
practices. If not using a virtual environment, please consider passing the
widely recommended `'--user' flag`_ when invoking ``pip``.
.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
.. code-block:: bash
$ pip install 'molecule[docker]'

View file

@ -1,22 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: instance-${TOX_ENVNAME}
image: ${MOLECULE_DISTRO:-'centos:7'}
command: /sbin/init
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
provisioner:
name: ansible
lint:
name: ansible-lint
verifier:
name: testinfra
lint:
name: flake8

View file

@ -1,5 +0,0 @@
---
- name: Converge
hosts: all
roles:
- role: ansible-role-example

View file

@ -1,12 +0,0 @@
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']
).get_hosts('all')
def test_hello_world_file(host):
f = host.file('/tmp/hello-world.txt')
assert f.exists

View file

@ -10,7 +10,7 @@ skipsdist = true
[base] [base]
passenv = * passenv = *
deps = deps =
-rrequirements.txt -r.requirements.txt
ansible25: ansible==2.5 ansible25: ansible==2.5
ansible26: ansible==2.6 ansible26: ansible==2.6
ansible27: ansible==2.7 ansible27: ansible==2.7
@ -18,7 +18,7 @@ deps =
ansible29: ansible==2.9 ansible29: ansible==2.9
ansiblelatest: ansible ansiblelatest: ansible
commands = commands =
molecule test ansible-playbook .ansible-test.yml -i localhost
setenv = setenv =
TOX_ENVNAME={envname} TOX_ENVNAME={envname}
MOLECULE_EPHEMERAL_DIRECTORY=/tmp/{envname} MOLECULE_EPHEMERAL_DIRECTORY=/tmp/{envname}