ansible-role-zuul/tasks/service.yaml
Paul Belanger 9ecd092e43 Split zuul service state into own task
It is possible we want to enable a service on boot, but don't want to
ensure it is currently running. This splits our systemd tasks into 2
different checks now.

Change-Id: Ic4d9cd8f770f72c262a099dddd6372c155bae133
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2019-01-19 12:06:39 -05:00

419 lines
17 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.
---
- name: Define zuul_file_zuul_executor_service_dest
set_fact:
zuul_file_zuul_executor_service_dest: "{{ __zuul_file_zuul_executor_service_dest }}"
when: zuul_file_zuul_executor_service_dest is not defined
- name: Define zuul_file_zuul_executor_service_mode
set_fact:
zuul_file_zuul_executor_service_mode: "{{ __zuul_file_zuul_executor_service_mode }}"
when: zuul_file_zuul_executor_service_mode is not defined
- name: Define zuul_file_zuul_executor_service_src
set_fact:
zuul_file_zuul_executor_service_src: "{{ __zuul_file_zuul_executor_service_src }}"
when: zuul_file_zuul_executor_service_src is not defined
- name: Define zuul_file_zuul_executor_service_config_dest
set_fact:
zuul_file_zuul_executor_service_config_dest: "{{ __zuul_file_zuul_executor_service_config_dest }}"
when: zuul_file_zuul_executor_service_config_dest is not defined
- name: Define zuul_file_zuul_executor_service_config_mode
set_fact:
zuul_file_zuul_executor_service_config_mode: "{{ __zuul_file_zuul_executor_service_config_mode }}"
when: zuul_file_zuul_executor_service_config_mode is not defined
- name: Define zuul_file_zuul_executor_service_config_src
set_fact:
zuul_file_zuul_executor_service_config_src: "{{ __zuul_file_zuul_executor_service_config_src }}"
when: zuul_file_zuul_executor_service_config_src is not defined
- name: Define zuul_file_zuul_fingergw_service_dest
set_fact:
zuul_file_zuul_fingergw_service_dest: "{{ __zuul_file_zuul_fingergw_service_dest }}"
when: zuul_file_zuul_fingergw_service_dest is not defined
- name: Define zuul_file_zuul_fingergw_service_mode
set_fact:
zuul_file_zuul_fingergw_service_mode: "{{ __zuul_file_zuul_fingergw_service_mode }}"
when: zuul_file_zuul_fingergw_service_mode is not defined
- name: Define zuul_file_zuul_fingergw_service_src
set_fact:
zuul_file_zuul_fingergw_service_src: "{{ __zuul_file_zuul_fingergw_service_src }}"
when: zuul_file_zuul_fingergw_service_src is not defined
- name: Define zuul_file_zuul_fingergw_service_config_dest
set_fact:
zuul_file_zuul_fingergw_service_config_dest: "{{ __zuul_file_zuul_fingergw_service_config_dest }}"
when: zuul_file_zuul_fingergw_service_config_dest is not defined
- name: Define zuul_file_zuul_fingergw_service_config_mode
set_fact:
zuul_file_zuul_fingergw_service_config_mode: "{{ __zuul_file_zuul_fingergw_service_config_mode }}"
when: zuul_file_zuul_fingergw_service_config_mode is not defined
- name: Define zuul_file_zuul_fingergw_service_config_src
set_fact:
zuul_file_zuul_fingergw_service_config_src: "{{ __zuul_file_zuul_fingergw_service_config_src }}"
when: zuul_file_zuul_fingergw_service_config_src is not defined
- name: Define zuul_file_zuul_merger_service_dest
set_fact:
zuul_file_zuul_merger_service_dest: "{{ __zuul_file_zuul_merger_service_dest }}"
when: zuul_file_zuul_merger_service_dest is not defined
- name: Define zuul_file_zuul_merger_service_mode
set_fact:
zuul_file_zuul_merger_service_mode: "{{ __zuul_file_zuul_merger_service_mode }}"
when: zuul_file_zuul_merger_service_mode is not defined
- name: Define zuul_file_zuul_merger_service_src
set_fact:
zuul_file_zuul_merger_service_src: "{{ __zuul_file_zuul_merger_service_src }}"
when: zuul_file_zuul_merger_service_src is not defined
- name: Define zuul_file_zuul_merger_service_config_dest
set_fact:
zuul_file_zuul_merger_service_config_dest: "{{ __zuul_file_zuul_merger_service_config_dest }}"
when: zuul_file_zuul_merger_service_config_dest is not defined
- name: Define zuul_file_zuul_merger_service_config_mode
set_fact:
zuul_file_zuul_merger_service_config_mode: "{{ __zuul_file_zuul_merger_service_config_mode }}"
when: zuul_file_zuul_merger_service_config_mode is not defined
- name: Define zuul_file_zuul_merger_service_config_src
set_fact:
zuul_file_zuul_merger_service_config_src: "{{ __zuul_file_zuul_merger_service_config_src }}"
when: zuul_file_zuul_merger_service_config_src is not defined
- name: Define zuul_file_zuul_scheduler_service_dest
set_fact:
zuul_file_zuul_scheduler_service_dest: "{{ __zuul_file_zuul_scheduler_service_dest }}"
when: zuul_file_zuul_scheduler_service_dest is not defined
- name: Define zuul_file_zuul_scheduler_service_mode
set_fact:
zuul_file_zuul_scheduler_service_mode: "{{ __zuul_file_zuul_scheduler_service_mode }}"
when: zuul_file_zuul_scheduler_service_mode is not defined
- name: Define zuul_file_zuul_scheduler_service_src
set_fact:
zuul_file_zuul_scheduler_service_src: "{{ __zuul_file_zuul_scheduler_service_src }}"
when: zuul_file_zuul_scheduler_service_src is not defined
- name: Define zuul_file_zuul_scheduler_service_config_dest
set_fact:
zuul_file_zuul_scheduler_service_config_dest: "{{ __zuul_file_zuul_scheduler_service_config_dest }}"
when: zuul_file_zuul_scheduler_service_config_dest is not defined
- name: Define zuul_file_zuul_scheduler_service_config_mode
set_fact:
zuul_file_zuul_scheduler_service_config_mode: "{{ __zuul_file_zuul_scheduler_service_config_mode }}"
when: zuul_file_zuul_scheduler_service_config_mode is not defined
- name: Define zuul_file_zuul_scheduler_service_config_src
set_fact:
zuul_file_zuul_scheduler_service_config_src: "{{ __zuul_file_zuul_scheduler_service_config_src }}"
when: zuul_file_zuul_scheduler_service_config_src is not defined
- name: Define zuul_file_zuul_web_service_dest
set_fact:
zuul_file_zuul_web_service_dest: "{{ __zuul_file_zuul_web_service_dest }}"
when: zuul_file_zuul_web_service_dest is not defined
- name: Define zuul_file_zuul_web_service_mode
set_fact:
zuul_file_zuul_web_service_mode: "{{ __zuul_file_zuul_web_service_mode }}"
when: zuul_file_zuul_web_service_mode is not defined
- name: Define zuul_file_zuul_web_service_src
set_fact:
zuul_file_zuul_web_service_src: "{{ __zuul_file_zuul_web_service_src }}"
when: zuul_file_zuul_web_service_src is not defined
- name: Define zuul_file_zuul_web_service_config_dest
set_fact:
zuul_file_zuul_web_service_config_dest: "{{ __zuul_file_zuul_web_service_config_dest }}"
when: zuul_file_zuul_web_service_config_dest is not defined
- name: Define zuul_file_zuul_web_service_config_mode
set_fact:
zuul_file_zuul_web_service_config_mode: "{{ __zuul_file_zuul_web_service_config_mode }}"
when: zuul_file_zuul_web_service_config_mode is not defined
- name: Define zuul_file_zuul_web_service_config_src
set_fact:
zuul_file_zuul_web_service_config_src: "{{ __zuul_file_zuul_web_service_config_src }}"
when: zuul_file_zuul_web_service_config_src is not defined
- name: Install zuul-executor service into place
become: true
template:
dest: "{{ zuul_file_zuul_executor_service_dest }}"
group: "{{ zuul_file_zuul_executor_service_group }}"
mode: "{{ zuul_file_zuul_executor_service_mode }}"
owner: "{{ zuul_file_zuul_executor_service_owner }}"
src: "{{ zuul_file_zuul_executor_service_src }}"
register: zuul_file_zuul_executor_service
when: zuul_file_zuul_executor_service_manage
- name: Create zuul-executor service config directory
become: true
file:
group: "{{ zuul_file_zuul_executor_service_config_group }}"
owner: "{{ zuul_file_zuul_executor_service_config_owner }}"
path: "{{ zuul_file_zuul_executor_service_dest }}.d"
state: directory
when: zuul_file_zuul_executor_service_config_manage
- name: Install zuul-executor service config into place
become: true
template:
dest: "{{ zuul_file_zuul_executor_service_config_dest }}"
group: "{{ zuul_file_zuul_executor_service_config_group }}"
mode: "{{ zuul_file_zuul_executor_service_config_mode }}"
owner: "{{ zuul_file_zuul_executor_service_config_owner }}"
src: "{{ zuul_file_zuul_executor_service_config_src }}"
register: zuul_file_zuul_executor_service_config
when: zuul_file_zuul_executor_service_config_manage
- name: Install zuul-fingergw service into place
become: true
template:
dest: "{{ zuul_file_zuul_fingergw_service_dest }}"
group: "{{ zuul_file_zuul_fingergw_service_group }}"
mode: "{{ zuul_file_zuul_fingergw_service_mode }}"
owner: "{{ zuul_file_zuul_fingergw_service_owner }}"
src: "{{ zuul_file_zuul_fingergw_service_src }}"
register: zuul_file_zuul_fingergw_service
when: zuul_file_zuul_fingergw_service_manage
- name: Create zuul-fingergw service config directory
become: true
file:
group: "{{ zuul_file_zuul_fingergw_service_config_group }}"
owner: "{{ zuul_file_zuul_fingergw_service_config_owner }}"
path: "{{ zuul_file_zuul_fingergw_service_dest }}.d"
state: directory
when: zuul_file_zuul_fingergw_service_config_manage
- name: Install zuul-fingergw service config into place
become: true
template:
dest: "{{ zuul_file_zuul_fingergw_service_config_dest }}"
group: "{{ zuul_file_zuul_fingergw_service_config_group }}"
mode: "{{ zuul_file_zuul_fingergw_service_config_mode }}"
owner: "{{ zuul_file_zuul_fingergw_service_config_owner }}"
src: "{{ zuul_file_zuul_fingergw_service_config_src }}"
register: zuul_file_zuul_fingergw_service_config
when: zuul_file_zuul_fingergw_service_config_manage
- name: Install zuul-merger service into place
become: true
template:
dest: "{{ zuul_file_zuul_merger_service_dest }}"
group: "{{ zuul_file_zuul_merger_service_group }}"
mode: "{{ zuul_file_zuul_merger_service_mode }}"
owner: "{{ zuul_file_zuul_merger_service_owner }}"
src: "{{ zuul_file_zuul_merger_service_src }}"
register: zuul_file_zuul_merger_service
when: zuul_file_zuul_merger_service_manage
- name: Create zuul-merger service config directory
become: true
file:
group: "{{ zuul_file_zuul_merger_service_config_group }}"
owner: "{{ zuul_file_zuul_merger_service_config_owner }}"
path: "{{ zuul_file_zuul_merger_service_dest }}.d"
state: directory
when: zuul_file_zuul_merger_service_config_manage
- name: Install zuul-merger service config into place
become: true
template:
dest: "{{ zuul_file_zuul_merger_service_config_dest }}"
group: "{{ zuul_file_zuul_merger_service_config_group }}"
mode: "{{ zuul_file_zuul_merger_service_config_mode }}"
owner: "{{ zuul_file_zuul_merger_service_config_owner }}"
src: "{{ zuul_file_zuul_merger_service_config_src }}"
register: zuul_file_zuul_merger_service_config
when: zuul_file_zuul_merger_service_config_manage
- name: Install zuul-scheduler service into place
become: true
template:
dest: "{{ zuul_file_zuul_scheduler_service_dest }}"
group: "{{ zuul_file_zuul_scheduler_service_group }}"
mode: "{{ zuul_file_zuul_scheduler_service_mode }}"
owner: "{{ zuul_file_zuul_scheduler_service_owner }}"
src: "{{ zuul_file_zuul_scheduler_service_src }}"
register: zuul_file_zuul_scheduler_service
when: zuul_file_zuul_scheduler_service_manage
- name: Create zuul-scheduler service config directory
become: true
file:
group: "{{ zuul_file_zuul_scheduler_service_config_group }}"
owner: "{{ zuul_file_zuul_scheduler_service_config_owner }}"
path: "{{ zuul_file_zuul_scheduler_service_dest }}.d"
state: directory
when: zuul_file_zuul_scheduler_service_config_manage
- name: Install zuul-scheduler service config into place
become: true
template:
dest: "{{ zuul_file_zuul_scheduler_service_config_dest }}"
group: "{{ zuul_file_zuul_scheduler_service_config_group }}"
mode: "{{ zuul_file_zuul_scheduler_service_config_mode }}"
owner: "{{ zuul_file_zuul_scheduler_service_config_owner }}"
src: "{{ zuul_file_zuul_scheduler_service_config_src }}"
register: zuul_file_zuul_scheduler_service_config
when: zuul_file_zuul_scheduler_service_config_manage
- name: Install zuul-web service into place
become: true
template:
dest: "{{ zuul_file_zuul_web_service_dest }}"
group: "{{ zuul_file_zuul_web_service_group }}"
mode: "{{ zuul_file_zuul_web_service_mode }}"
owner: "{{ zuul_file_zuul_web_service_owner }}"
src: "{{ zuul_file_zuul_web_service_src }}"
register: zuul_file_zuul_web_service
when: zuul_file_zuul_web_service_manage
- name: Create zuul-web service config directory
become: true
file:
group: "{{ zuul_file_zuul_web_service_config_group }}"
owner: "{{ zuul_file_zuul_web_service_config_owner }}"
path: "{{ zuul_file_zuul_web_service_dest }}.d"
state: directory
when: zuul_file_zuul_web_service_config_manage
- name: Install zuul-web service config into place
become: true
template:
dest: "{{ zuul_file_zuul_web_service_config_dest }}"
group: "{{ zuul_file_zuul_web_service_config_group }}"
mode: "{{ zuul_file_zuul_web_service_config_mode }}"
owner: "{{ zuul_file_zuul_web_service_config_owner }}"
src: "{{ zuul_file_zuul_web_service_config_src }}"
register: zuul_file_zuul_web_service_config
when: zuul_file_zuul_web_service_config_manage
- name: Enable zuul-executor service
become: true
systemd:
daemon_reload: "{{ zuul_service_zuul_executor_daemon_reload }}"
enabled: "{{ zuul_service_zuul_executor_enabled }}"
name: "{{ zuul_service_zuul_executor_name }}"
register: zuul_service_zuul_executor
when: zuul_service_zuul_executor_manage
- name: Set zuul-executor service state
become: true
systemd:
daemon_reload: "{{ zuul_service_zuul_executor_daemon_reload }}"
name: "{{ zuul_service_zuul_executor_name }}"
state: "{{ zuul_service_zuul_executor_state }}"
register: zuul_service_zuul_executor_state_info
when:
- zuul_service_zuul_executor_manage
- zuul_service_zuul_executor_state in ['reloaded', 'restarted', 'started', 'stopped']
- name: Enable zuul-fingergw service
become: true
systemd:
daemon_reload: "{{ zuul_service_zuul_fingergw_daemon_reload }}"
enabled: "{{ zuul_service_zuul_fingergw_enabled }}"
name: "{{ zuul_service_zuul_fingergw_name }}"
register: zuul_service_zuul_fingergw
when: zuul_service_zuul_fingergw_manage
- name: Set zuul-fingergw service state
become: true
systemd:
daemon_reload: "{{ zuul_service_zuul_fingergw_daemon_reload }}"
name: "{{ zuul_service_zuul_fingergw_name }}"
state: "{{ zuul_service_zuul_fingergw_state }}"
register: zuul_service_zuul_fingergw_state_info
when:
- zuul_service_zuul_fingergw_manage
- zuul_service_zuul_fingergw_state in ['reloaded', 'restarted', 'started', 'stopped']
- name: Enable zuul-merger service
become: true
systemd:
daemon_reload: "{{ zuul_service_zuul_merger_daemon_reload }}"
enabled: "{{ zuul_service_zuul_merger_enabled }}"
name: "{{ zuul_service_zuul_merger_name }}"
register: zuul_service_zuul_merger
when: zuul_service_zuul_merger_manage
- name: Set zuul-merger service state
become: true
systemd:
daemon_reload: "{{ zuul_service_zuul_merger_daemon_reload }}"
name: "{{ zuul_service_zuul_merger_name }}"
state: "{{ zuul_service_zuul_merger_state }}"
register: zuul_service_zuul_merger_state_info
when:
- zuul_service_zuul_merger_manage
- zuul_service_zuul_merger_state in ['reloaded', 'restarted', 'started', 'stopped']
- name: Enable zuul-scheduler service
become: true
systemd:
daemon_reload: "{{ zuul_service_zuul_scheduler_daemon_reload }}"
enabled: "{{ zuul_service_zuul_scheduler_enabled }}"
name: "{{ zuul_service_zuul_scheduler_name }}"
register: zuul_service_zuul_scheduler
when: zuul_service_zuul_scheduler_manage
- name: Set zuul-scheduler service state
become: true
systemd:
daemon_reload: "{{ zuul_service_zuul_scheduler_daemon_reload }}"
name: "{{ zuul_service_zuul_scheduler_name }}"
state: "{{ zuul_service_zuul_scheduler_state }}"
register: zuul_service_zuul_scheduler_state_info
when:
- zuul_service_zuul_scheduler_manage
- zuul_service_zuul_scheduler_state in ['reloaded', 'restarted', 'started', 'stopped']
- name: Enable zuul-web service
become: true
systemd:
daemon_reload: "{{ zuul_service_zuul_web_daemon_reload }}"
enabled: "{{ zuul_service_zuul_web_enabled }}"
name: "{{ zuul_service_zuul_web_name }}"
register: zuul_service_zuul_web
when: zuul_service_zuul_web_manage
- name: Set zuul-web service state
become: true
systemd:
daemon_reload: "{{ zuul_service_zuul_web_daemon_reload }}"
name: "{{ zuul_service_zuul_web_name }}"
state: "{{ zuul_service_zuul_web_state }}"
register: zuul_service_zuul_web_state_info
when:
- zuul_service_zuul_web_manage
- zuul_service_zuul_web_state in ['reloaded', 'restarted', 'started', 'stopped']