Support systemd for centos-7 and ubuntu-xenial

Because of a bug in ansible 2.2, it is easier for us to move to
systemd for ubuntu-xenial.

Change-Id: I0c4709f413b7beb131846b815a9e5c474b3221bb
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-11-24 14:49:27 -05:00
parent e359fd93fe
commit 8ebb97e3e9
11 changed files with 164 additions and 58 deletions

View File

@ -0,0 +1,13 @@
[Unit]
Description=Zuul Launcher Service
After=syslog.target network.target
[Service]
Type=simple
User=zuul
Group=zuul
EnvironmentFile=-/etc/default/zuul-launcher
ExecStart=/bin/sh -c "${PREFIX}/bin/zuul-launcher -d"
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=Zuul Merger Service
After=syslog.target network.target
[Service]
Type=simple
User=zuul
Group=zuul
LimitNOFILE=8192
EnvironmentFile=-/etc/default/zuul-merger
ExecStart=/bin/sh -c "${PREFIX}/bin/zuul-merger -d"
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=Zuul Server Service
After=syslog.target network.target
[Service]
Type=simple
User=zuul
Group=zuul
EnvironmentFile=-/etc/default/zuul-server
ExecStart=/bin/sh -c "${PREFIX}/bin/zuul-server -d"
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target

View File

@ -13,7 +13,12 @@
# under the License.
---
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yaml"
include_vars: "{{ ansible_distribution|lower }}-{{ ansible_distribution_release }}.yaml"
when: ansible_os_family == 'Debian'
- name: Include OS-specific variables.
include_vars: "{{ ansible_distribution|lower }}-{{ ansible_distribution_major_version }}.yaml"
when: ansible_os_family == 'RedHat'
- include: "{{ zuul_task }}.yaml"
with_items: "{{ zuul_task_manager }}"

View File

@ -129,18 +129,22 @@
- name: Register /etc/init.d/zuul-launcher
stat:
path: /etc/init.d/zuul-launcher
register: debian_zuul_launcher_service_stat
when: ansible_os_family == 'Debian'
register: _zuul_launcher_service_initd_stat
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_release == 'trusty'
- name: Assert debian_zuul_launcher_service_stat tests.
- name: Assert _zuul_launcher_service_initd_stat tests.
assert:
that:
- debian_zuul_launcher_service_stat.stat.exists
- debian_zuul_launcher_service_stat.stat.isreg
- debian_zuul_launcher_service_stat.stat.pw_name == 'root'
- debian_zuul_launcher_service_stat.stat.gr_name == 'root'
- debian_zuul_launcher_service_stat.stat.mode == '0755'
when: ansible_os_family == 'Debian'
- _zuul_launcher_service_initd_stat.stat.exists
- _zuul_launcher_service_initd_stat.stat.isreg
- _zuul_launcher_service_initd_stat.stat.pw_name == 'root'
- _zuul_launcher_service_initd_stat.stat.gr_name == 'root'
- _zuul_launcher_service_initd_stat.stat.mode == '0755'
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_release == 'trusty'
- name: Register /etc/default/zuul-launcher
stat:
@ -161,18 +165,22 @@
- 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'
register: _zuul_merger_service_initd_stat
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_release == 'trusty'
- name: Assert debian_zuul_merger_service_stat tests.
- name: Assert _zuul_merger_service_initd_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'
- _zuul_merger_service_initd_stat.stat.exists
- _zuul_merger_service_initd_stat.stat.isreg
- _zuul_merger_service_initd_stat.stat.pw_name == 'root'
- _zuul_merger_service_initd_stat.stat.gr_name == 'root'
- _zuul_merger_service_initd_stat.stat.mode == '0755'
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_release == 'trusty'
- name: Register /etc/default/zuul-merger
stat:
@ -193,18 +201,22 @@
- 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'
register: _zuul_server_service_initd_stat
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_release == 'trusty'
- name: Assert debian_zuul_server_service_stat tests.
- name: Assert _zuul_server_service_initd_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'
- _zuul_server_service_initd_stat.stat.exists
- _zuul_server_service_initd_stat.stat.isreg
- _zuul_server_service_initd_stat.stat.pw_name == 'root'
- _zuul_server_service_initd_stat.stat.gr_name == 'root'
- _zuul_server_service_initd_stat.stat.mode == '0755'
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_release == 'trusty'
- name: Register /etc/default/zuul-server
stat:
@ -225,18 +237,20 @@
- name: Register /etc/systemd/system/zuul-launcher.service
stat:
path: /etc/systemd/system/zuul-launcher.service
register: redhat_zuul_launcher_service_stat
when: ansible_os_family == 'RedHat'
register: _zuul_launcher_service_systemd_stat
when: (ansible_os_family == 'RedHat') or
(ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial')
- name: Assert redhat_zuul_launcher_service_stat tests.
- name: Assert _zuul_launcher_service_systemd_stat tests.
assert:
that:
- redhat_zuul_launcher_service_stat.stat.exists
- redhat_zuul_launcher_service_stat.stat.isreg
- redhat_zuul_launcher_service_stat.stat.pw_name == 'root'
- redhat_zuul_launcher_service_stat.stat.gr_name == 'root'
- redhat_zuul_launcher_service_stat.stat.mode == '0644'
when: ansible_os_family == 'RedHat'
- _zuul_launcher_service_systemd_stat.stat.exists
- _zuul_launcher_service_systemd_stat.stat.isreg
- _zuul_launcher_service_systemd_stat.stat.pw_name == 'root'
- _zuul_launcher_service_systemd_stat.stat.gr_name == 'root'
- _zuul_launcher_service_systemd_stat.stat.mode == '0644'
when: (ansible_os_family == 'RedHat') or
(ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial')
- name: Register /etc/sysconfig/zuul-launcher
stat:
@ -257,18 +271,20 @@
- 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'
register: _zuul_merger_service_systemd_stat
when: (ansible_os_family == 'RedHat') or
(ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial')
- name: Assert redhat_zuul_merger_service_stat tests.
- name: Assert _zuul_merger_service_systemd_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'
- _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'
when: (ansible_os_family == 'RedHat') or
(ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial')
- name: Register /etc/sysconfig/zuul-merger
stat:
@ -289,18 +305,20 @@
- 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'
register: _zuul_server_service_systemd_stat
when: (ansible_os_family == 'RedHat') or
(ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial')
- name: Assert redhat_zuul_server_service_stat tests.
- name: Assert _zuul_server_service_systemd_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'
- _zuul_server_service_systemd_stat.stat.exists
- _zuul_server_service_systemd_stat.stat.isreg
- _zuul_server_service_systemd_stat.stat.pw_name == 'root'
- _zuul_server_service_systemd_stat.stat.gr_name == 'root'
- _zuul_server_service_systemd_stat.stat.mode == '0644'
when: (ansible_os_family == 'RedHat') or
(ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial')
- name: Register /etc/sysconfig/zuul-server
stat:

View File

@ -20,7 +20,7 @@ __zuul_build_depends:
__zuul_file_zuul_launcher_service_dest: /etc/systemd/system/zuul-launcher.service
__zuul_file_zuul_launcher_service_mode: 0644
__zuul_file_zuul_launcher_service_src: etc/systemd/system/zuul-launcher.service
__zuul_file_zuul_launcher_service_src: etc/systemd/system/zuul-launcher.service.centos-7
__zuul_file_zuul_launcher_service_config_dest: /etc/sysconfig/zuul-launcher
__zuul_file_zuul_launcher_service_config_mode: 0644
@ -28,7 +28,7 @@ __zuul_file_zuul_launcher_service_config_src: etc/sysconfig/zuul-launcher
__zuul_file_zuul_merger_service_dest: /etc/systemd/system/zuul-merger.service
__zuul_file_zuul_merger_service_mode: 0644
__zuul_file_zuul_merger_service_src: etc/systemd/system/zuul-merger.service
__zuul_file_zuul_merger_service_src: etc/systemd/system/zuul-merger.service.centos-7
__zuul_file_zuul_merger_service_config_dest: /etc/sysconfig/zuul-merger
__zuul_file_zuul_merger_service_config_mode: 0644
@ -36,7 +36,7 @@ __zuul_file_zuul_merger_service_config_src: etc/sysconfig/zuul-merger
__zuul_file_zuul_server_service_dest: /etc/systemd/system/zuul-server.service
__zuul_file_zuul_server_service_mode: 0644
__zuul_file_zuul_server_service_src: etc/systemd/system/zuul-server.service
__zuul_file_zuul_server_service_src: etc/systemd/system/zuul-server.service.centos-7
__zuul_file_zuul_server_service_config_dest: /etc/sysconfig/zuul-server
__zuul_file_zuul_server_service_config_mode: 0644

42
vars/ubuntu-xenial.yaml Normal file
View File

@ -0,0 +1,42 @@
# 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.
---
__zuul_build_depends:
- build-essential
- git
- python-dev
__zuul_file_zuul_launcher_service_dest: /etc/systemd/system/zuul-launcher.service
__zuul_file_zuul_launcher_service_mode: 0644
__zuul_file_zuul_launcher_service_src: etc/systemd/system/zuul-launcher.service.ubuntu-xenial
__zuul_file_zuul_launcher_service_config_dest: /etc/default/zuul-launcher
__zuul_file_zuul_launcher_service_config_mode: 0644
__zuul_file_zuul_launcher_service_config_src: etc/default/zuul-launcher
__zuul_file_zuul_merger_service_dest: /etc/systemd/system/zuul-merger.service
__zuul_file_zuul_merger_service_mode: 0644
__zuul_file_zuul_merger_service_src: etc/systemd/system/zuul-merger.service.ubuntu-xenial
__zuul_file_zuul_merger_service_config_dest: /etc/default/zuul-merger
__zuul_file_zuul_merger_service_config_mode: 0644
__zuul_file_zuul_merger_service_config_src: etc/default/zuul-merger
__zuul_file_zuul_server_service_dest: /etc/systemd/system/zuul-server.service
__zuul_file_zuul_server_service_mode: 0644
__zuul_file_zuul_server_service_src: etc/systemd/system/zuul-server.service.ubuntu-xenial
__zuul_file_zuul_server_service_config_dest: /etc/default/zuul-server
__zuul_file_zuul_server_service_config_mode: 0644
__zuul_file_zuul_server_service_config_src: etc/default/zuul-server