diff --git a/.zuul.yaml b/.zuul.yaml new file mode 100644 index 0000000..af033d6 --- /dev/null +++ b/.zuul.yaml @@ -0,0 +1,39 @@ +- job: + name: ansible-role-ssh + run: tests/playbooks/run.yaml + roles: + - zuul: openstack/ansible-role-ssh + +- job: + name: ansible-role-ssh-fedora-27 + parent: ansible-role-ssh + nodeset: fedora-27 + +- job: + name: ansible-role-ssh-ubuntu-bionic + parent: ansible-role-ssh + nodeset: ubuntu-bionic + +- job: + name: ansible-role-ssh-ubuntu-xenial + parent: ansible-role-ssh + nodeset: ubuntu-xenial + +- project: + name: openstack/ansible-role-ssh + templates: + - windmill-jobs-fedora-27 + - windmill-jobs-bionic + - windmill-jobs-xenial + check: + jobs: + - ansible-role-ssh-fedora-27 + - ansible-role-ssh-ubuntu-bionic + - ansible-role-ssh-ubuntu-xenial + - tox-linters + gate: + jobs: + - ansible-role-ssh-fedora-27 + - ansible-role-ssh-ubuntu-bionic + - ansible-role-ssh-ubuntu-xenial + - tox-linters diff --git a/meta/main.yml b/meta/main.yml index f9eaeb8..7f29698 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -20,11 +20,15 @@ galaxy_info: unsecured network. company: Red Hat, Inc. license: Apache - min_ansible_version: 2.0 + min_ansible_version: 2.4 platforms: - - name: EL + - name: Fedora versions: - - 7 + - 27 + - name: Ubuntu + versions: + - 16.04 + - 18.04 categories: - - cloud + - system dependencies: [] diff --git a/requirements.txt b/requirements.txt index 1ab0ddd..f3a3f52 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -ansible>=2.0.0 +ansible>=2.4.0 diff --git a/tests/ansible.cfg b/tests/ansible.cfg deleted file mode 100644 index 6c8a344..0000000 --- a/tests/ansible.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[defaults] -roles_path = ../.. diff --git a/tests/inventory b/tests/inventory index e512180..2fbb50c 100644 --- a/tests/inventory +++ b/tests/inventory @@ -1,2 +1 @@ -[test] -test01 ansible_host=127.0.0.2 +localhost diff --git a/tests/test.yaml b/tests/playbooks/run.yaml similarity index 68% rename from tests/test.yaml rename to tests/playbooks/run.yaml index 5c57f3d..85ffd2e 100644 --- a/tests/test.yaml +++ b/tests/playbooks/run.yaml @@ -1,4 +1,4 @@ -# Copyright 2015 Red Hat, Inc. +# Copyright 2018 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,20 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. --- -- hosts: test - +- hosts: all vars: - rolename: "{{ lookup('pipe', 'pwd') | dirname | basename }}" + rolename: ansible-role-ssh ssh_user_name: "{{ ansible_user }}" ssh_user_home: /tmp/.ssh - pre_tasks: - # Make sure OS does not have a stale package cache. - - name: Update apt cache. - become: yes - apt: - update_cache: yes - when: ansible_os_family == 'Debian' - roles: - "{{ rolename }}" diff --git a/tox.ini b/tox.ini index 5a1853f..03ba7dc 100644 --- a/tox.ini +++ b/tox.ini @@ -10,29 +10,6 @@ deps = -r{toxinidir}/requirements.txt [testenv:docs] commands = python setup.py build_sphinx -[testenv:functional] -commands = - ansible-playbook -i tests/inventory tests/test.yaml -e ansible_user={env:USER} -passenv = HOME -setenv = - ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg - PYTHONUNBUFFERED = 1 - -[testenv:linters] -setenv = - ANSIBLE_CONFIG = tests/ansible.cfg -whitelist_externals = bash -commands = - # PEP8 Lint Check - flake8 - # Ansible Lint Check - bash -c "find . -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 \ - ansible-lint" - # Ansible Syntax Check - bash -c "find tests -type f -regex '.*.y[a]?ml' -print | xargs -t -n1 \ - ansible-playbook --syntax-check -i tests/inventory \ - -e rolename=$(basename $(pwd)) > /dev/null" - [testenv:venv] commands = {posargs} @@ -44,3 +21,17 @@ ignore = E123,E125 builtins = _ exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build +[testenv:linters] +setenv = + ANSIBLE_ROLES_PATH = .. +whitelist_externals = bash +commands = + # PEP8 Lint Check + flake8 + # Ansible Lint Check + bash -c "find . -not -path '*/\.*' -type f -regex '.*.y[a]?ml' -print0 | \ + xargs -t -n1 -0 ansible-lint" + # Ansible Syntax Check + bash -c "find tests -type f -regex '.*.y[a]?ml' -print | xargs -t -n1 \ + ansible-playbook --syntax-check -i tests/inventory \ + -e rolename=$(basename $(pwd)) > /dev/null"