Add systemd support for geard

Include the ability for a user to run geard.

Change-Id: I6a075da4f1b094930948aad3ebfa912bcd598d42
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2018-02-22 22:02:06 -05:00
parent 26f7fa0cfe
commit 56cf700fd0
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
6 changed files with 118 additions and 1 deletions

View File

@ -41,3 +41,16 @@ gear_pip_name: gear
# gear_pip_virtualenv:
# tasks/service.yaml
gear_file_gear_service_manage: true
gear_file_gear_service_group: root
gear_file_gear_service_owner: root
gear_file_gear_service_config_manage: true
gear_file_gear_service_config_group: root
gear_file_gear_service_config_owner: root
gear_service_gear_daemon_reload: true
gear_service_gear_enabled: yes
gear_service_gear_manage: true
gear_service_gear_name: gear
gear_service_gear_state: started

View File

@ -1,4 +1,4 @@
# Copyright 2017 Red Hat, Inc.
# Copyright 2018 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.
@ -12,3 +12,73 @@
# License for the specific language governing permissions and limitations
# under the License.
---
- name: Define gear_file_gear_service_dest.
set_fact:
gear_file_gear_service_dest: "{{ __gear_file_gear_service_dest }}"
when: gear_file_gear_dest is not defined
- name: Define gear_file_gear_service_mode.
set_fact:
gear_file_gear_service_mode: "{{ __gear_file_gear_service_mode }}"
when: gear_file_gear_service_mode is not defined
- name: Define gear_file_gear_service_src.
set_fact:
gear_file_gear_service_src: "{{ __gear_file_gear_service_src }}"
when: gear_file_gear_service_src is not defined
- name: Define gear_file_gear_service_config_dest.
set_fact:
gear_file_gear_service_config_dest: "{{ __gear_file_gear_service_config_dest }}"
when: gear_file_gear_service_config_dest is not defined
- name: Define gear_file_gear_service_config_mode.
set_fact:
gear_file_gear_service_config_mode: "{{ __gear_file_gear_service_config_mode }}"
when: gear_file_gear_service_config_mode is not defined
- name: Define gear_file_gear_service_config_src.
set_fact:
gear_file_gear_service_config_src: "{{ __gear_file_gear_service_config_src }}"
when: gear_file_gear_service_config_src is not defined
- name: Install gear service script into place.
become: yes
template:
dest: "{{ gear_file_gear_service_dest }}"
group: "{{ gear_file_gear_service_group }}"
mode: "{{ gear_file_gear_service_mode }}"
owner: "{{ gear_file_gear_service_owner }}"
src: "{{ gear_file_gear_service_src }}"
register: gear_file_gear_service
when: gear_file_gear_service_manage
- name: Create gear service config directory.
become: yes
file:
group: "{{ gear_file_gear_service_config_group }}"
owner: "{{ gear_file_gear_service_config_owner }}"
path: "{{ gear_file_gear_service_dest }}.d"
state: directory
when: gear_file_gear_service_config_manage
- name: Install gear service config into place.
become: yes
template:
dest: "{{ gear_file_gear_service_config_dest }}"
group: "{{ gear_file_gear_service_config_group }}"
mode: "{{ gear_file_gear_service_config_mode }}"
owner: "{{ gear_file_gear_service_config_owner }}"
src: "{{ gear_file_gear_service_config_src }}"
register: gear_file_gear_service_config
when: gear_file_gear_service_config_manage
- name: Enable gear service.
become: yes
systemd:
daemon_reload: "{{ gear_service_gear_daemon_reload }}"
enabled: "{{ gear_service_gear_enabled }}"
name: "{{ gear_service_gear_name }}"
state: "{{ gear_service_gear_state }}"
register: gear_service_gear
when: gear_service_gear_manage

View File

@ -0,0 +1,15 @@
[Unit]
Description=Gear Service
After=syslog.target network.target
[Service]
Type=simple
# The prefix used when gear was installed. Be sure to update this
# value if you are using a virtualenv.
Environment="PREFIX=/usr/local"
Group=gear
User=gear
ExecStart=/bin/sh -c "${PREFIX}/bin/geard -d"
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,3 @@
# This file is generated by Ansible
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
#

View File

@ -13,3 +13,11 @@
# under the License.
---
__gear_build_depends: []
__gear_file_gear_service_dest: /etc/systemd/system/gear.service
__gear_file_gear_service_mode: 0644
__gear_file_gear_service_src: etc/systemd/system/gear.service
__gear_file_gear_service_config_dest: /etc/systemd/system/gear.service.d/override.conf
__gear_file_gear_service_config_mode: 0644
__gear_file_gear_service_config_src: etc/systemd/system/gear.service.d/override.conf

View File

@ -13,3 +13,11 @@
# under the License.
---
__gear_build_depends: []
__gear_file_gear_service_dest: /etc/systemd/system/gear.service
__gear_file_gear_service_mode: 0644
__gear_file_gear_service_src: etc/systemd/system/gear.service
__gear_file_gear_service_config_dest: /etc/systemd/system/gear.service.d/override.conf
__gear_file_gear_service_config_mode: 0644
__gear_file_gear_service_config_src: etc/systemd/system/gear.service.d/override.conf