Add tox deploy job to validate bootstrap process

When a user tries windmill, they have a multiple options to actually
run ansible. However, we can atleast provide a basic way to bootstrap
a host and validate our playbooks and roles are in working order.

This could also be a simple way to try newer version of ansible, under
zuul gains the ability to support that.

Change-Id: I4e97b0f10437adf7a153148cc7fa5ae45e81d4de
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2018-03-27 22:11:27 -04:00
parent 549cb217b7
commit bd142ffa4b
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
7 changed files with 42 additions and 32 deletions

19
.zuul.d/jobs-tox.yaml Normal file
View File

@ -0,0 +1,19 @@
- job:
name: windmill-tox-deploy
parent: tox
run: tests/playbooks/tox/run.yaml
nodeset: ubuntu-xenial
required-projects:
- openstack/ansible-role-diskimage-builder
- openstack/ansible-role-gearman
- openstack/ansible-role-logrotate
- openstack/ansible-role-nodepool
- openstack/ansible-role-shade
- openstack/ansible-role-ssh
- openstack/ansible-role-sudoers
- openstack/ansible-role-virtualenv
- openstack/ansible-role-zookeeper
- openstack/ansible-role-zuul
vars:
tox_envlist: deploy
tox_extra_args: '-vv -- --extra-vars "@tests/extra-vars.yaml"'

View File

@ -4,3 +4,9 @@
- windmill-jobs-fedora-27
- windmill-jobs-bionic
- windmill-jobs-xenial
check:
jobs:
- windmill-tox-deploy
gate:
jobs:
- windmill-tox-deploy

View File

@ -3,3 +3,4 @@ paramiko<2.0.0
ansible>=2.0.0,<2.4.0
bindep
netaddr

5
tests/extra-vars.yaml Normal file
View File

@ -0,0 +1,5 @@
# NOTE(pabelanger): In the gate, we want to create a zuul-test user /
# group as zuul already exists on our images.
zuul_user_name: zuul-test
zuul_user_group: zuul-test
zuul_user_home: /var/lib/zuul

View File

@ -0,0 +1,3 @@
- hosts: all
roles:
- tox

View File

@ -15,4 +15,10 @@
TOOLSDIR=$(dirname $0)
# NOTE(pabelanger): Check if we are running in the gate, if so use cached repos
# to avoid hitting the network.
if [ -f /etc/ci/mirror_info.sh ]; then
sed -e "s|https://|file://${HOME}/src/|g" -i $TOOLSDIR/requirements.yaml
fi
ansible-galaxy install -v -r $TOOLSDIR/requirements.yaml -p playbooks/roles

34
tox.ini
View File

@ -15,28 +15,14 @@ deps = -r{toxinidir}/requirements.txt
deps = bindep
commands = bindep test
[testenv:buildimages]
deps = -r{toxinidir}/requirements.txt
commands =
{toxinidir}/tools/install_bindep.sh
{toxinidir}/tools/install_roles.sh
# NOTE(pabelanger): Because ansible default ansible_user to null now, we need to pass it via CLI.
ansible-playbook -i playbooks/inventory playbooks/build-images.yaml -e ansible_user={env:USER} {posargs}
passenv =
HOME
SSH_AUTH_SOCK
USER
setenv =
ANSIBLE_CONFIG = {toxinidir}/playbooks/ansible.cfg
PYTHONUNBUFFERED = 1
[testenv:deploy]
deps = -r{toxinidir}/requirements.txt
commands =
{toxinidir}/tools/install_bindep.sh
{toxinidir}/tools/install_roles.sh
# NOTE(pabelanger): Because ansible default ansible_user to null now, we need to pass it via CLI.
ansible-playbook -i inventory/single-node playbooks/site.yaml -e ansible_user={env:USER} {posargs}
ansible-playbook -i inventory/single-node playbooks/bastion.yaml {posargs}
ansible-playbook -i inventory/single-node playbooks/site.yaml {posargs}
passenv =
HOME
SSH_AUTH_SOCK
@ -45,22 +31,6 @@ setenv =
ANSIBLE_CONFIG = {toxinidir}/playbooks/ansible.cfg
PYTHONUNBUFFERED = 1
[testenv:publish-images]
deps = -r{toxinidir}/requirements.txt
commands =
{toxinidir}/tools/install_bindep.sh
{toxinidir}/tools/install_roles.sh
# NOTE(pabelanger): Because ansible default ansible_user to null now, we need to pass it via CLI.
ansible-playbook -i playbooks/inventory playbooks/build-images.yaml -e ansible_user={env:USER} {posargs}
passenv =
HOME
SSH_AUTH_SOCK
USER
WORKSPACE
setenv =
ANSIBLE_CONFIG = {toxinidir}/playbooks/ansible.cfg
PYTHONUNBUFFERED = 1
[testenv:docs]
commands = python setup.py build_sphinx