Convert role to use a common systemd service role
This removes the systemd service templates and tasks from this role and leverages a common systemd service role instead. This change removes a lot of code duplication across all roles all without sacrificing features or functionality. The intention of this change is to ensure uniformity and reduce the maintenance burden on the community when sweeping changes are needed. Change-Id: I47287ce0deb45538894bd99e57c291c3ae7fa084 Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
d3baa0001b
commit
b44d7ba5bf
|
@ -133,14 +133,17 @@ aodh_services:
|
|||
aodh-notifier:
|
||||
group: aodh_alarm_notifier
|
||||
service_name: aodh-notifier
|
||||
execstarts: "{{ aodh_bin }}/aodh-notifier"
|
||||
init_config_overrides: "{{ aodh_alarm_notifier_init_overrides }}"
|
||||
aodh-evaluator:
|
||||
group: aodh_alarm_evaluator
|
||||
service_name: aodh-evaluator
|
||||
execstarts: "{{ aodh_bin }}/aodh-evaluator"
|
||||
init_config_overrides: "{{ aodh_alarm_evaluator_init_overrides }}"
|
||||
aodh-listener:
|
||||
group: aodh_listener
|
||||
service_name: aodh-listener
|
||||
execstarts: "{{ aodh_bin }}/aodh-listener"
|
||||
init_config_overrides: "{{ aodh_listener_init_overrides }}"
|
||||
|
||||
aodh_required_secrets:
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
---
|
||||
# Copyright 2016, Rackspace US, 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: Create TEMP run dir
|
||||
file:
|
||||
path: "/var/run/{{ item.service_name }}"
|
||||
state: directory
|
||||
owner: "{{ aodh_system_user_name }}"
|
||||
group: "{{ aodh_system_group_name }}"
|
||||
mode: "02755"
|
||||
with_items: "{{ filtered_aodh_services }}"
|
||||
|
||||
- name: Create TEMP lock dir
|
||||
file:
|
||||
path: "/var/lock/{{ item.service_name }}"
|
||||
state: directory
|
||||
owner: "{{ aodh_system_user_name }}"
|
||||
group: "{{ aodh_system_group_name }}"
|
||||
mode: "02755"
|
||||
with_items: "{{ filtered_aodh_services }}"
|
||||
|
||||
- name: Create tmpfiles.d entry
|
||||
template:
|
||||
src: "aodh-systemd-tmpfiles.j2"
|
||||
dest: "/etc/tmpfiles.d/openstack-{{ item.service_name }}.conf"
|
||||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
with_items: "{{ filtered_aodh_services }}"
|
||||
notify:
|
||||
- Restart aodh services
|
||||
|
||||
- name: Place the systemd init script
|
||||
config_template:
|
||||
src: "aodh-systemd-init.j2"
|
||||
dest: "/etc/systemd/system/{{ item.service_name }}.service"
|
||||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
config_overrides: "{{ item.init_config_overrides }}"
|
||||
config_type: "ini"
|
||||
with_items: "{{ filtered_aodh_services }}"
|
||||
notify:
|
||||
- Restart aodh services
|
|
@ -44,7 +44,29 @@
|
|||
tags:
|
||||
- aodh-config
|
||||
|
||||
- include: "aodh_init_{{ ansible_service_mgr }}.yml"
|
||||
- name: Run the systemd service role
|
||||
include_role:
|
||||
name: systemd_service
|
||||
private: true
|
||||
vars:
|
||||
systemd_user_name: "{{ aodh_system_user_name }}"
|
||||
systemd_group_name: "{{ aodh_system_group_name }}"
|
||||
systemd_tempd_prefix: openstack
|
||||
systemd_slice_name: aodh
|
||||
system_lock_path: /var/lock/aodh
|
||||
systemd_CPUAccounting: true
|
||||
systemd_BlockIOAccounting: true
|
||||
systemd_MemoryAccounting: true
|
||||
systemd_TasksAccounting: true
|
||||
systemd_services:
|
||||
- service_name: "{{ service_var.service_name }}"
|
||||
enabled: yes
|
||||
state: started
|
||||
execstarts: "{{ service_var.execstarts }}"
|
||||
config_overrides: "{{ service_var.init_config_overrides }}"
|
||||
with_items: "{{ filtered_aodh_services }}"
|
||||
loop_control:
|
||||
loop_var: service_var
|
||||
tags:
|
||||
- aodh-config
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description=aodh openstack service
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User={{ aodh_system_user_name }}
|
||||
Group={{ aodh_system_group_name }}
|
||||
|
||||
{% if item.program_override is defined %}
|
||||
ExecStart={{ item.program_override }} {{ item.program_config_options|default('') }} --log-file=/var/log/aodh/{{ item.service_name }}.log
|
||||
{% else %}
|
||||
ExecStart={{ aodh_bin }}/{{ item.service_name }} {{ item.program_config_options|default('') }} --log-file=/var/log/aodh/{{ item.service_name }}.log
|
||||
{% endif %}
|
||||
|
||||
# Give a reasonable amount of time for the server to start up/shut down
|
||||
TimeoutSec=120
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
|
||||
# This creates a specific slice which all services will operate from
|
||||
# The accounting options give us the ability to see resource usage through
|
||||
# the `systemd-cgtop` command.
|
||||
Slice=aodh.slice
|
||||
CPUAccounting=true
|
||||
BlockIOAccounting=true
|
||||
MemoryAccounting=false
|
||||
TasksAccounting=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,4 +0,0 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
D /var/lock/{{ item.service_name }} 2755 {{ aodh_system_user_name }} {{ aodh_system_group_name }}
|
||||
D /var/run/{{ item.service_name }} 2755 {{ aodh_system_user_name }} {{ aodh_system_group_name }}
|
Loading…
Reference in New Issue