ansible-role-zuul-registry/tasks/service.yaml

95 lines
4.4 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_registry_file_zuul_registry_service_dest
set_fact:
zuul_registry_file_zuul_registry_service_dest: "{{ __zuul_registry_file_zuul_registry_service_dest }}"
when: zuul_registry_file_zuul_registry_service_dest is not defined
- name: Define zuul_registry_file_zuul_registry_service_mode
set_fact:
zuul_registry_file_zuul_registry_service_mode: "{{ __zuul_registry_file_zuul_registry_service_mode }}"
when: zuul_registry_file_zuul_registry_service_mode is not defined
- name: Define zuul_registry_file_zuul_registry_service_src
set_fact:
zuul_registry_file_zuul_registry_service_src: "{{ __zuul_registry_file_zuul_registry_service_src }}"
when: zuul_registry_file_zuul_registry_service_src is not defined
- name: Define zuul_registry_file_zuul_registry_service_config_dest
set_fact:
zuul_registry_file_zuul_registry_service_config_dest: "{{ __zuul_registry_file_zuul_registry_service_config_dest }}"
when: zuul_registry_file_zuul_registry_service_config_dest is not defined
- name: Define zuul_registry_file_zuul_registry_service_config_mode
set_fact:
zuul_registry_file_zuul_registry_service_config_mode: "{{ __zuul_registry_file_zuul_registry_service_config_mode }}"
when: zuul_registry_file_zuul_registry_service_config_mode is not defined
- name: Define zuul_registry_file_zuul_registry_service_config_src
set_fact:
zuul_registry_file_zuul_registry_service_config_src: "{{ __zuul_registry_file_zuul_registry_service_config_src }}"
when: zuul_registry_file_zuul_registry_service_config_src is not defined
- name: Install zuul-registry service script into place
become: true
template:
dest: "{{ zuul_registry_file_zuul_registry_service_dest }}"
group: "{{ zuul_registry_file_zuul_registry_service_group }}"
mode: "{{ zuul_registry_file_zuul_registry_service_mode }}"
owner: "{{ zuul_registry_file_zuul_registry_service_owner }}"
src: "{{ zuul_registry_file_zuul_registry_service_src }}"
register: zuul_registry_file_zuul_registry_service
when: zuul_registry_file_zuul_registry_service_manage
- name: Create zuul-registry service config directory
become: true
file:
group: "{{ zuul_registry_file_zuul_registry_service_config_group }}"
owner: "{{ zuul_registry_file_zuul_registry_service_config_owner }}"
path: "{{ zuul_registry_file_zuul_registry_service_dest }}.d"
state: directory
when: zuul_registry_file_zuul_registry_service_config_manage
- name: Install zuul-registry service config into place
become: true
template:
dest: "{{ zuul_registry_file_zuul_registry_service_config_dest }}"
group: "{{ zuul_registry_file_zuul_registry_service_config_group }}"
mode: "{{ zuul_registry_file_zuul_registry_service_config_mode }}"
owner: "{{ zuul_registry_file_zuul_registry_service_config_owner }}"
src: "{{ zuul_registry_file_zuul_registry_service_config_src }}"
register: zuul_registry_file_zuul_registry_service_config
when: zuul_registry_file_zuul_registry_service_config_manage
- name: Enable zuul-registry service
become: true
systemd:
daemon_reload: "{{ zuul_registry_service_zuul_registry_daemon_reload }}"
enabled: "{{ zuul_registry_service_zuul_registry_enabled }}"
name: "{{ zuul_registry_service_zuul_registry_name }}"
register: zuul_registry_service_zuul_registry
when: zuul_registry_service_zuul_registry_manage
- name: Set zuul-registry service state
become: true
systemd:
daemon_reload: "{{ zuul_registry_service_zuul_registry_daemon_reload }}"
name: "{{ zuul_registry_service_zuul_registry_name }}"
state: "{{ zuul_registry_service_zuul_registry_state }}"
register: zuul_registry_service_zuul_registry_state_info
when:
- zuul_registry_service_zuul_registry_manage
- zuul_registry_service_zuul_registry_state in ['reloaded', 'restarted', 'started', 'stopped']