ansible-role-nodepool/tasks/service.yaml
Paul Belanger c3c980e21d Split nodepool 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: Ib37371031a871d0d57b390e2430ea1efb3094171
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2019-01-20 18:23:39 -05:00

176 lines
8.0 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 nodepool_file_nodepool_builder_service_dest
set_fact:
nodepool_file_nodepool_builder_service_dest: "{{ __nodepool_file_nodepool_builder_service_dest }}"
when: nodepool_file_nodepool_builder_service_dest is not defined
- name: Define nodepool_file_nodepool_builder_service_mode
set_fact:
nodepool_file_nodepool_builder_service_mode: "{{ __nodepool_file_nodepool_builder_service_mode }}"
when: nodepool_file_nodepool_builder_service_mode is not defined
- name: Define nodepool_file_nodepool_builder_service_src
set_fact:
nodepool_file_nodepool_builder_service_src: "{{ __nodepool_file_nodepool_builder_service_src }}"
when: nodepool_file_nodepool_builder_service_src is not defined
- name: Define nodepool_file_nodepool_builder_service_config_dest
set_fact:
nodepool_file_nodepool_builder_service_config_dest: "{{ __nodepool_file_nodepool_builder_service_config_dest }}"
when: nodepool_file_nodepool_builder_service_config_dest is not defined
- name: Define nodepool_file_nodepool_builder_service_config_mode
set_fact:
nodepool_file_nodepool_builder_service_config_mode: "{{ __nodepool_file_nodepool_builder_service_config_mode }}"
when: nodepool_file_nodepool_builder_service_config_mode is not defined
- name: Define nodepool_file_nodepool_builder_service_config_src
set_fact:
nodepool_file_nodepool_builder_service_config_src: "{{ __nodepool_file_nodepool_builder_service_config_src }}"
when: nodepool_file_nodepool_builder_service_config_src is not defined
- name: Define nodepool_file_nodepool_launcher_service_dest
set_fact:
nodepool_file_nodepool_launcher_service_dest: "{{ __nodepool_file_nodepool_launcher_service_dest }}"
when: nodepool_file_nodepool_launcher_service_dest is not defined
- name: Define nodepool_file_nodepool_launcher_service_mode
set_fact:
nodepool_file_nodepool_launcher_service_mode: "{{ __nodepool_file_nodepool_launcher_service_mode }}"
when: nodepool_file_nodepool_launcher_service_mode is not defined
- name: Define nodepool_file_nodepool_launcher_service_src
set_fact:
nodepool_file_nodepool_launcher_service_src: "{{ __nodepool_file_nodepool_launcher_service_src }}"
when: nodepool_file_nodepool_launcher_service_src is not defined
- name: Define nodepool_file_nodepool_launcher_service_config_dest
set_fact:
nodepool_file_nodepool_launcher_service_config_dest: "{{ __nodepool_file_nodepool_launcher_service_config_dest }}"
when: nodepool_file_nodepool_launcher_service_config_dest is not defined
- name: Define nodepool_file_nodepool_launcher_service_config_mode
set_fact:
nodepool_file_nodepool_launcher_service_config_mode: "{{ __nodepool_file_nodepool_launcher_service_config_mode }}"
when: nodepool_file_nodepool_launcher_service_config_mode is not defined
- name: Define nodepool_file_nodepool_launcher_service_config_src
set_fact:
nodepool_file_nodepool_launcher_service_config_src: "{{ __nodepool_file_nodepool_launcher_service_config_src }}"
when: nodepool_file_nodepool_launcher_service_config_src is not defined
- name: Install nodepool-builder service script into place
become: true
template:
dest: "{{ nodepool_file_nodepool_builder_service_dest }}"
group: "{{ nodepool_file_nodepool_builder_service_group }}"
mode: "{{ nodepool_file_nodepool_builder_service_mode }}"
owner: "{{ nodepool_file_nodepool_builder_service_owner }}"
src: "{{ nodepool_file_nodepool_builder_service_src }}"
register: nodepool_file_nodepool_builder_service
when: nodepool_file_nodepool_builder_service_manage
- name: Create nodepool-builder service config directory
become: true
file:
group: "{{ nodepool_file_nodepool_builder_service_config_group }}"
owner: "{{ nodepool_file_nodepool_builder_service_config_owner }}"
path: "{{ nodepool_file_nodepool_builder_service_dest }}.d"
state: directory
when: nodepool_file_nodepool_builder_service_config_manage
- name: Install nodepool-builder service config into place
become: true
template:
dest: "{{ nodepool_file_nodepool_builder_service_config_dest }}"
group: "{{ nodepool_file_nodepool_builder_service_config_group }}"
mode: "{{ nodepool_file_nodepool_builder_service_config_mode }}"
owner: "{{ nodepool_file_nodepool_builder_service_config_owner }}"
src: "{{ nodepool_file_nodepool_builder_service_config_src }}"
register: nodepool_file_nodepool_builder_service_config
when: nodepool_file_nodepool_builder_service_config_manage
- name: Install nodepool-launcher service script into place
become: true
template:
dest: "{{ nodepool_file_nodepool_launcher_service_dest }}"
group: "{{ nodepool_file_nodepool_launcher_service_group }}"
mode: "{{ nodepool_file_nodepool_launcher_service_mode }}"
owner: "{{ nodepool_file_nodepool_launcher_service_owner }}"
src: "{{ nodepool_file_nodepool_launcher_service_src }}"
register: nodepool_file_nodepool_launcher_service
when: nodepool_file_nodepool_launcher_service_manage
- name: Create nodepool-launcher service config directory
become: true
file:
group: "{{ nodepool_file_nodepool_launcher_service_config_group }}"
owner: "{{ nodepool_file_nodepool_launcher_service_config_owner }}"
path: "{{ nodepool_file_nodepool_launcher_service_dest }}.d"
state: directory
when: nodepool_file_nodepool_launcher_service_config_manage
- name: Install nodepool-launcher service config into place
become: true
template:
dest: "{{ nodepool_file_nodepool_launcher_service_config_dest }}"
group: "{{ nodepool_file_nodepool_launcher_service_config_group }}"
mode: "{{ nodepool_file_nodepool_launcher_service_config_mode }}"
owner: "{{ nodepool_file_nodepool_launcher_service_config_owner }}"
src: "{{ nodepool_file_nodepool_launcher_service_config_src }}"
register: nodepool_file_nodepool_launcher_service_config
when: nodepool_file_nodepool_launcher_service_config_manage
- name: Enable nodepool-builder service
become: true
systemd:
daemon_reload: "{{ nodepool_service_nodepool_builder_daemon_reload }}"
enabled: "{{ nodepool_service_nodepool_builder_enabled }}"
name: "{{ nodepool_service_nodepool_builder_name }}"
register: nodepool_service_nodepool_builder
when: nodepool_service_nodepool_builder_manage
- name: Set nodepool-builder service state
become: true
systemd:
daemon_reload: "{{ nodepool_service_nodepool_builder_daemon_reload }}"
name: "{{ nodepool_service_nodepool_builder_name }}"
state: "{{ nodepool_service_nodepool_builder_state }}"
register: nodepool_service_nodepool_builder_state_info
when:
- nodepool_service_nodepool_builder_manage
- nodepool_service_nodepool_builder_state in ['reloaded', 'restarted', 'started', 'stopped']
- name: Enable nodepool-launcher service
become: true
systemd:
daemon_reload: "{{ nodepool_service_nodepool_launcher_daemon_reload }}"
enabled: "{{ nodepool_service_nodepool_launcher_enabled }}"
name: "{{ nodepool_service_nodepool_launcher_name }}"
register: nodepool_service_nodepool_launcher
when: nodepool_service_nodepool_launcher_manage
- name: Set nodepool-launcher service state
become: true
systemd:
daemon_reload: "{{ nodepool_service_nodepool_launcher_daemon_reload }}"
name: "{{ nodepool_service_nodepool_launcher_name }}"
state: "{{ nodepool_service_nodepool_launcher_state }}"
register: nodepool_service_nodepool_launcher_state_info
when:
- nodepool_service_nodepool_launcher_manage
- nodepool_service_nodepool_launcher_state in ['reloaded', 'restarted', 'started', 'stopped']