# 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: localhost sudo: yes vars: rolename: "{{ lookup('pipe', 'pwd') | dirname | basename }}" pre_tasks: # Make sure OS does not have a stale package cache. - name: Update apt cache. apt: update_cache: yes when: ansible_os_family == 'Debian' roles: - "{{ rolename }}" post_tasks: - name: Ensure zuul_user_name is zuul. shell: /usr/bin/getent passwd zuul - name: Ensure zuul_user_group is zuul. shell: /usr/bin/getent group zuul - name: Register zuul_user_home_getent. shell: '/usr/bin/getent passwd zuul | cut -d: -f6' register: zuul_user_home_getent - 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: /opt/ansible-role-zuul/git/openstack-infra/zuul register: zuul_git_dest_stat - name: Assert zuul_git_dest tests. assert: that: - zuul_git_dest_stat.stat.exists - zuul_git_dest_stat.stat.isdir - 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 # NOTE(pabelanger): This means we are hardcoded to the # openstack-infra jenkins user in nodepool. - zuul_layout_stat.stat.pw_name == 'jenkins' - zuul_layout_stat.stat.gr_name == 'jenkins' - 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 # NOTE(pabelanger): This means we are hardcoded to the # openstack-infra jenkins user in nodepool. - zuul_layout_yaml_stat.stat.pw_name == 'jenkins' - zuul_layout_yaml_stat.stat.gr_name == 'jenkins' - name: Register /etc/default/zuul stat: path: /etc/default/zuul register: debian_zuul_service_config_stat when: ansible_os_family == 'Debian' - name: Assert debian_zuul_service_config_stat tests. assert: that: - debian_zuul_service_config_stat.stat.exists - debian_zuul_service_config_stat.stat.isreg - debian_zuul_service_config_stat.stat.pw_name == 'root' - debian_zuul_service_config_stat.stat.gr_name == 'root' - debian_zuul_service_config_stat.stat.mode == '0644' when: ansible_os_family == 'Debian' - name: Register /etc/init.d/zuul-merger stat: path: /etc/init.d/zuul-merger register: debian_zuul_merger_service_stat when: ansible_os_family == 'Debian' - name: Assert debian_zuul_merger_service_stat tests. assert: that: - debian_zuul_merger_service_stat.stat.exists - debian_zuul_merger_service_stat.stat.isreg - debian_zuul_merger_service_stat.stat.pw_name == 'root' - debian_zuul_merger_service_stat.stat.gr_name == 'root' - debian_zuul_merger_service_stat.stat.mode == '0755' when: ansible_os_family == 'Debian' - name: Register /etc/init.d/zuul-server stat: path: /etc/init.d/zuul-server register: debian_zuul_server_service_stat when: ansible_os_family == 'Debian' - name: Assert debian_zuul_server_service_stat tests. assert: that: - debian_zuul_server_service_stat.stat.exists - debian_zuul_server_service_stat.stat.isreg - debian_zuul_server_service_stat.stat.pw_name == 'root' - debian_zuul_server_service_stat.stat.gr_name == 'root' - debian_zuul_server_service_stat.stat.mode == '0755' when: ansible_os_family == 'Debian' - name: Register /etc/sysconfig/zuul stat: path: /etc/sysconfig/zuul register: redhat_zuul_service_config_stat when: ansible_os_family == 'RedHat' - name: Assert redhat_zuul_service_config_stat tests. assert: that: - redhat_zuul_service_config_stat.stat.exists - redhat_zuul_service_config_stat.stat.isreg - redhat_zuul_service_config_stat.stat.pw_name == 'root' - redhat_zuul_service_config_stat.stat.gr_name == 'root' - redhat_zuul_service_config_stat.stat.mode == '0644' when: ansible_os_family == 'RedHat' - name: Register /etc/systemd/system/zuul-merger.service stat: path: /etc/systemd/system/zuul-merger.service register: redhat_zuul_merger_service_stat when: ansible_os_family == 'RedHat' - name: Assert redhat_zuul_merger_service_stat tests. assert: that: - redhat_zuul_merger_service_stat.stat.exists - redhat_zuul_merger_service_stat.stat.isreg - redhat_zuul_merger_service_stat.stat.pw_name == 'root' - redhat_zuul_merger_service_stat.stat.gr_name == 'root' - redhat_zuul_merger_service_stat.stat.mode == '0644' when: ansible_os_family == 'RedHat' - name: Register /etc/systemd/system/zuul-server.service stat: path: /etc/systemd/system/zuul-server.service register: redhat_zuul_server_service_stat when: ansible_os_family == 'RedHat' - name: Assert redhat_zuul_server_service_stat tests. assert: that: - redhat_zuul_server_service_stat.stat.exists - redhat_zuul_server_service_stat.stat.isreg - redhat_zuul_server_service_stat.stat.pw_name == 'root' - redhat_zuul_server_service_stat.stat.gr_name == 'root' - redhat_zuul_server_service_stat.stat.mode == '0644' when: ansible_os_family == 'RedHat' - name: Ensure zuul-merger is running. shell: /usr/sbin/service zuul-merger status tags: skip_ansible_lint - name: Ensure zuul-server is running. shell: /usr/sbin/service zuul-server status tags: skip_ansible_lint