ansible-role-zuul/tests/playbooks/run.yaml
Paul Belanger 65e23fa622
Refactor jobs to support pip / git installation testing
Because we want users to support both pip / git install methods,
refactor testing to support the testing of that.

Change-Id: I8c6bfa94b22af73f84ead571d04181e4cfb8330e
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2018-04-12 21:51:17 -04:00

348 lines
13 KiB
YAML

# Copyright 2015 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
---
- hosts: all
vars:
rolename: ansible-role-zuul
zuul_file_zuul_executor_service_config_src: etc/systemd/system/override.conf.j2
zuul_file_zuul_merger_service_config_src: etc/systemd/system/override.conf.j2
zuul_file_zuul_scheduler_service_config_src: etc/systemd/system/override.conf.j2
zuul_file_zuul_web_service_config_src: etc/systemd/system/override.conf.j2
zuul_user_name: zuul-test
zuul_user_group: zuul-test
zuul_pip_executable: pip3
roles:
- "{{ rolename }}"
post_tasks:
- name: Assert results are registered.
assert:
that:
- zuul_file_gearman_logging_conf
- zuul_file_gearman_ssl_ca
- zuul_file_gearman_ssl_cert
- zuul_file_gearman_ssl_key
- zuul_file_executor_logging_conf
- zuul_file_fingergw_logging_conf
- zuul_file_merger_logging_conf
- zuul_file_scheduler_logging_conf
- zuul_file_web_logging_conf
- zuul_file_layout
- zuul_file_zuul_conf
- zuul_file_zuul_executor_service
- zuul_file_zuul_executor_service_config
- zuul_file_zuul_fingergw_service
- zuul_file_zuul_fingergw_service_config
- zuul_file_zuul_merger_service
- zuul_file_zuul_merger_service_config
- zuul_file_zuul_scheduler_service
- zuul_file_zuul_scheduler_service_config
- zuul_file_zuul_web_service
- zuul_file_zuul_web_service_config
- zuul_service_zuul_executor
- zuul_service_zuul_fingergw
- zuul_service_zuul_merger
- zuul_service_zuul_scheduler
- zuul_service_zuul_web
- name: Ensure zuul_user_name is zuul.
shell: /usr/bin/getent passwd zuul-test
tags: skip_ansible_lint
- name: Ensure zuul_user_group is zuul.
shell: /usr/bin/getent group zuul-test
tags: skip_ansible_lint
- name: Register zuul_user_home_getent.
shell: '/usr/bin/getent passwd zuul-test | cut -d: -f6'
register: zuul_user_home_getent
tags: skip_ansible_lint
- name: Assert zuul_user_home is /var/lib/zuul.
assert:
that:
- zuul_user_home_getent.stdout == '/var/lib/zuul'
- name: Register zuul_user_home_stat.
stat:
path: /var/lib/zuul
register: zuul_user_home_stat
- name: Assert zuul_user_home tests.
assert:
that:
- zuul_user_home_stat.stat.exists
- zuul_user_home_stat.stat.isdir
- name: Register zuul_git_dest_stat.
stat:
path: /home/zuul/src/git.openstack.org/openstack-infra/zuul
register: zuul_git_dest_stat
when: zuul_install_method == 'git'
- name: Assert zuul_git_dest tests.
assert:
that:
- zuul_git_dest_stat.stat.exists
- zuul_git_dest_stat.stat.isdir
when: zuul_install_method == 'git'
- name: Register /etc/zuul/config/
stat:
path: /etc/zuul/config/
register: zuul_layout_stat
- name: Assert zuul_layout_stat tests.
assert:
that:
- zuul_layout_stat.stat.exists
- zuul_layout_stat.stat.isdir
- zuul_layout_stat.stat.pw_name == 'zuul-test'
- zuul_layout_stat.stat.gr_name == 'zuul-test'
- zuul_layout_stat.stat.mode == '0755'
- name: Register /etc/zuul/config/layout.yaml
stat:
path: /etc/zuul/config/layout.yaml
register: zuul_layout_yaml_stat
- name: Assert zuul_layout_yaml_stat tests.
assert:
that:
- zuul_layout_yaml_stat.stat.exists
- zuul_layout_yaml_stat.stat.isreg
- zuul_layout_yaml_stat.stat.pw_name == 'zuul-test'
- zuul_layout_yaml_stat.stat.gr_name == 'zuul-test'
- name: Register /etc/zuul/zuul.conf
stat:
path: /etc/zuul/zuul.conf
register: zuul_conf_stat
- name: Assert zuul_conf_stat tests.
assert:
that:
- zuul_conf_stat.stat.exists
- zuul_conf_stat.stat.isreg
- zuul_conf_stat.stat.pw_name == 'zuul-test'
- zuul_conf_stat.stat.gr_name == 'zuul-test'
- name: Register /etc/zuul/ssl/root-ca.pem
stat:
path: /etc/zuul/ssl/root-ca.pem
register: _zuul_file_gearman_ssl_ca_stat
- name: Assert _zuul_file_gearman_ssl_ca_stat tests.
assert:
that:
- _zuul_file_gearman_ssl_ca_stat.stat.exists
- _zuul_file_gearman_ssl_ca_stat.stat.isreg
- _zuul_file_gearman_ssl_ca_stat.stat.pw_name == 'zuul-test'
- _zuul_file_gearman_ssl_ca_stat.stat.gr_name == 'zuul-test'
- _zuul_file_gearman_ssl_ca_stat.stat.mode == '0644'
- name: Register /etc/zuul/ssl/client.pem
stat:
path: /etc/zuul/ssl/client.pem
register: _zuul_file_gearman_ssl_cert_stat
- name: Assert _zuul_file_gearman_ssl_cert_stat tests.
assert:
that:
- _zuul_file_gearman_ssl_cert_stat.stat.exists
- _zuul_file_gearman_ssl_cert_stat.stat.isreg
- _zuul_file_gearman_ssl_cert_stat.stat.pw_name == 'zuul-test'
- _zuul_file_gearman_ssl_cert_stat.stat.gr_name == 'zuul-test'
- _zuul_file_gearman_ssl_cert_stat.stat.mode == '0644'
- name: Register /etc/zuul/ssl/client.key
stat:
path: /etc/zuul/ssl/client.key
register: _zuul_file_gearman_ssl_key_stat
- name: Assert _zuul_file_gearman_ssl_key_stat tests.
assert:
that:
- _zuul_file_gearman_ssl_key_stat.stat.exists
- _zuul_file_gearman_ssl_key_stat.stat.isreg
- _zuul_file_gearman_ssl_key_stat.stat.pw_name == 'zuul-test'
- _zuul_file_gearman_ssl_key_stat.stat.gr_name == 'zuul-test'
- _zuul_file_gearman_ssl_key_stat.stat.mode == '0600'
- name: Register /etc/systemd/system/zuul-executor.service.d/override.conf
stat:
path: /etc/systemd/system/zuul-executor.service.d/override.conf
register: zuul_executor_service_config_stat
- name: Assert zuul_executor_service_config_stat tests.
assert:
that:
- zuul_executor_service_config_stat.stat.exists
- zuul_executor_service_config_stat.stat.isreg
- zuul_executor_service_config_stat.stat.pw_name == 'root'
- zuul_executor_service_config_stat.stat.gr_name == 'root'
- zuul_executor_service_config_stat.stat.mode == '0644'
- name: Register /etc/systemd/system/zuul-fingergw.service.d/override.conf
stat:
path: /etc/systemd/system/zuul-fingergw.service.d/override.conf
register: zuul_fingergw_service_config_stat
- name: Assert zuul_fingergw_service_config_stat tests.
assert:
that:
- zuul_fingergw_service_config_stat.stat.exists
- zuul_fingergw_service_config_stat.stat.isreg
- zuul_fingergw_service_config_stat.stat.pw_name == 'root'
- zuul_fingergw_service_config_stat.stat.gr_name == 'root'
- zuul_fingergw_service_config_stat.stat.mode == '0644'
- name: Register /etc/systemd/system/zuul-merger.service.d/override.conf
stat:
path: /etc/systemd/system/zuul-merger.service.d/override.conf
register: zuul_merger_service_config_stat
- name: Assert zuul_merger_service_config_stat tests.
assert:
that:
- zuul_merger_service_config_stat.stat.exists
- zuul_merger_service_config_stat.stat.isreg
- zuul_merger_service_config_stat.stat.pw_name == 'root'
- zuul_merger_service_config_stat.stat.gr_name == 'root'
- zuul_merger_service_config_stat.stat.mode == '0644'
- name: Register /etc/systemd/system/zuul-scheduler.service.d/override.conf
stat:
path: /etc/systemd/system/zuul-scheduler.service.d/override.conf
register: zuul_scheduler_service_config_stat
- name: Assert zuul_scheduler_service_config_stat tests.
assert:
that:
- zuul_scheduler_service_config_stat.stat.exists
- zuul_scheduler_service_config_stat.stat.isreg
- zuul_scheduler_service_config_stat.stat.pw_name == 'root'
- zuul_scheduler_service_config_stat.stat.gr_name == 'root'
- zuul_scheduler_service_config_stat.stat.mode == '0644'
- name: Register /etc/systemd/system/zuul-web.service.d/override.conf
stat:
path: /etc/systemd/system/zuul-web.service.d/override.conf
register: zuul_web_service_config_stat
- name: Assert zuul_web_service_config_stat tests.
assert:
that:
- zuul_web_service_config_stat.stat.exists
- zuul_web_service_config_stat.stat.isreg
- zuul_web_service_config_stat.stat.pw_name == 'root'
- zuul_web_service_config_stat.stat.gr_name == 'root'
- zuul_web_service_config_stat.stat.mode == '0644'
- name: Register /etc/systemd/system/zuul-executor.service
stat:
path: /etc/systemd/system/zuul-executor.service
register: _zuul_executor_service_systemd_stat
- name: Assert _zuul_executor_service_systemd_stat tests.
assert:
that:
- _zuul_executor_service_systemd_stat.stat.exists
- _zuul_executor_service_systemd_stat.stat.isreg
- _zuul_executor_service_systemd_stat.stat.pw_name == 'root'
- _zuul_executor_service_systemd_stat.stat.gr_name == 'root'
- _zuul_executor_service_systemd_stat.stat.mode == '0644'
- name: Register /etc/systemd/system/zuul-fingergw.service
stat:
path: /etc/systemd/system/zuul-fingergw.service
register: _zuul_fingergw_service_systemd_stat
- name: Assert _zuul_fingergw_service_systemd_stat tests.
assert:
that:
- _zuul_fingergw_service_systemd_stat.stat.exists
- _zuul_fingergw_service_systemd_stat.stat.isreg
- _zuul_fingergw_service_systemd_stat.stat.pw_name == 'root'
- _zuul_fingergw_service_systemd_stat.stat.gr_name == 'root'
- _zuul_fingergw_service_systemd_stat.stat.mode == '0644'
- name: Register /etc/systemd/system/zuul-merger.service
stat:
path: /etc/systemd/system/zuul-merger.service
register: _zuul_merger_service_systemd_stat
- name: Assert _zuul_merger_service_systemd_stat tests.
assert:
that:
- _zuul_merger_service_systemd_stat.stat.exists
- _zuul_merger_service_systemd_stat.stat.isreg
- _zuul_merger_service_systemd_stat.stat.pw_name == 'root'
- _zuul_merger_service_systemd_stat.stat.gr_name == 'root'
- _zuul_merger_service_systemd_stat.stat.mode == '0644'
- name: Register /etc/systemd/system/zuul-scheduler.service
stat:
path: /etc/systemd/system/zuul-scheduler.service
register: _zuul_scheduler_service_systemd_stat
- name: Assert _zuul_scheduler_service_systemd_stat tests.
assert:
that:
- _zuul_scheduler_service_systemd_stat.stat.exists
- _zuul_scheduler_service_systemd_stat.stat.isreg
- _zuul_scheduler_service_systemd_stat.stat.pw_name == 'root'
- _zuul_scheduler_service_systemd_stat.stat.gr_name == 'root'
- _zuul_scheduler_service_systemd_stat.stat.mode == '0644'
- name: Register /etc/systemd/system/zuul-web.service
stat:
path: /etc/systemd/system/zuul-web.service
register: _zuul_web_service_systemd_stat
- name: Assert _zuul_web_service_systemd_stat tests.
assert:
that:
- _zuul_web_service_systemd_stat.stat.exists
- _zuul_web_service_systemd_stat.stat.isreg
- _zuul_web_service_systemd_stat.stat.pw_name == 'root'
- _zuul_web_service_systemd_stat.stat.gr_name == 'root'
- _zuul_web_service_systemd_stat.stat.mode == '0644'
- name: Ensure zuul-executor is running.
become: yes
shell: /usr/sbin/service zuul-executor status
tags: skip_ansible_lint
- name: Ensure zuul-fingergw is running.
become: yes
shell: /usr/sbin/service zuul-fingergw status
tags: skip_ansible_lint
- name: Ensure zuul-merger is running.
become: yes
shell: /usr/sbin/service zuul-merger status
tags: skip_ansible_lint
- name: Ensure zuul-scheduler is running.
become: yes
shell: /usr/sbin/service zuul-scheduler status
tags: skip_ansible_lint
- name: Ensure zuul-web is running.
become: yes
shell: /usr/sbin/service zuul-web status
tags: skip_ansible_lint