Merge "Convert role to use a common systemd service role"

This commit is contained in:
Zuul 2018-06-01 07:20:34 +00:00 committed by Gerrit Code Review
commit 4d02b6927b
5 changed files with 39 additions and 116 deletions

View File

@ -434,8 +434,8 @@ nova_services:
service_name: nova-api-metadata
init_config_overrides: "{{ nova_api_metadata_init_overrides }}"
start_order: 4
log_string: "--logto "
program_override: "{{ nova_bin }}/uwsgi --ini /etc/uwsgi/nova-api-metadata.ini"
execstarts: "{{ nova_bin }}/uwsgi --ini /etc/uwsgi/nova-api-metadata.ini"
execreloads: "{{ nova_bin }}/uwsgi --reload /var/run/nova-api-metadata/nova-api-metadata.pid"
wsgi_app: True
wsgi_overrides: "{{ nova_api_metadata_uwsgi_ini_overrides }}"
uwsgi_port: "{{ nova_metadata_port }}"
@ -445,8 +445,8 @@ nova_services:
service_name: nova-api-os-compute
init_config_overrides: "{{ nova_api_os_compute_init_overrides }}"
start_order: 3
log_string: "--logto "
program_override: "{{ nova_bin }}/uwsgi --ini /etc/uwsgi/nova-api-os-compute.ini"
execstarts: "{{ nova_bin }}/uwsgi --ini /etc/uwsgi/nova-api-os-compute.ini"
execreloads: "{{ nova_bin }}/uwsgi --reload /var/run/nova-api-os-compute/nova-api-os-compute.pid"
wsgi_app: True
wsgi_overrides: "{{ nova_api_os_compute_uwsgi_ini_overrides }}"
uwsgi_port: "{{ nova_service_port }}"
@ -456,41 +456,49 @@ nova_services:
service_name: nova-compute
init_config_overrides: "{{ nova_compute_init_overrides }}"
start_order: 5
execstarts: "{{ nova_bin }}/nova-compute"
execreloads: "/bin/kill -HUP $MAINPID"
nova-conductor:
group: nova_conductor
service_name: nova-conductor
init_config_overrides: "{{ nova_conductor_init_overrides }}"
start_order: 1
execstarts: "{{ nova_bin }}/nova-conductor"
execreloads: "/bin/kill -HUP $MAINPID"
nova-consoleauth:
group: nova_console
service_name: nova-consoleauth
init_config_overrides: "{{ nova_consoleauth_init_overrides }}"
start_order: 2
execstarts: "{{ nova_bin }}/nova-consoleauth"
nova-novncproxy:
group: nova_console
service_name: nova-novncproxy
init_config_overrides: "{{ nova_novncproxy_init_overrides }}"
condition: "{{ nova_console_type == 'novnc' }}"
start_order: 4
execstarts: "{{ nova_bin }}/nova-novncproxy"
nova-scheduler:
group: nova_scheduler
service_name: nova-scheduler
init_config_overrides: "{{ nova_scheduler_init_overrides }}"
start_order: 2
execstarts: "{{ nova_bin }}/nova-scheduler"
execreloads: "/bin/kill -HUP $MAINPID"
nova-spicehtml5proxy:
group: nova_console
service_name: nova-spicehtml5proxy
init_config_overrides: "{{ nova_spicehtml5proxy_init_overrides }}"
condition: "{{ nova_console_type == 'spice' }}"
start_order: 4
execstarts: "{{ nova_bin }}/nova-spicehtml5proxy"
nova-placement-api:
group: nova_api_placement
service_name: nova-placement-api
init_config_overrides: "{{ nova_placement_api_init_overrides }}"
condition: "{{ nova_placement_service_enabled | bool }}"
log_string: "--logto "
start_order: 3
program_override: "{{ nova_bin }}/uwsgi --ini /etc/uwsgi/nova-placement-api.ini"
execstarts: "{{ nova_bin }}/uwsgi --ini /etc/uwsgi/nova-placement-api.ini"
wsgi_app: True
uwsgi_port: "{{ nova_placement_service_port }}"
wsgi_name: nova-placement-api
@ -501,6 +509,7 @@ nova_services:
init_config_overrides: "{{ nova_serialproxy_init_overrides }}"
condition: "{{ nova_console_type == 'serialconsole' }}"
start_order: 4
execstarts: "{{ nova_bin }}/nova-serialproxy"
nova_novnc_pip_packages:
- websockify

View File

@ -88,7 +88,30 @@
tags:
- nova-config
- include_tasks: "nova_init_{{ ansible_service_mgr}}.yml"
- name: Run the systemd service role
include_role:
name: systemd_service
private: true
vars:
systemd_user_name: "{{ nova_system_user_name }}"
systemd_group_name: "{{ nova_system_group_name }}"
systemd_tempd_prefix: openstack
systemd_slice_name: nova
system_lock_path: /var/lock/nova
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 }}"
execreloads: "{{ service_var.execreloads | default([]) }}"
config_overrides: "{{ service_var.init_config_overrides }}"
with_items: "{{ filtered_nova_services }}"
loop_control:
loop_var: service_var
tags:
- nova-config

View File

@ -1,67 +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: "{{ nova_system_user_name }}"
group: "{{ nova_system_group_name }}"
mode: "02755"
with_items: "{{ filtered_nova_services }}"
- name: Create TEMP lock dir
file:
path: "/var/lock/{{ item.service_name }}"
state: directory
owner: "{{ nova_system_user_name }}"
group: "{{ nova_system_group_name }}"
mode: "02755"
with_items: "{{ filtered_nova_services }}"
# TODO(mgariepy):
# Remove this in Pike as it only needed to handle upgrades
# from Newton->Newton and Newton->Ocata
- name: Cleanup old tmpfiles.d entry
file:
path: "/etc/tmpfiles.d/{{ item.service_name }}.conf"
state: absent
with_items: "{{ filtered_nova_services }}"
- name: Create tmpfiles.d entry
template:
src: "nova-systemd-tmpfiles.j2"
dest: "/etc/tmpfiles.d/openstack-{{ item.service_name }}.conf"
mode: "0644"
owner: "root"
group: "root"
with_items: "{{ filtered_nova_services }}"
notify:
- Manage LB
- Restart nova services
- name: Place the systemd init script
config_template:
src: "nova-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_nova_services }}"
notify:
- Manage LB
- Restart nova services

View File

@ -1,37 +0,0 @@
# {{ ansible_managed }}
[Unit]
Description=nova openstack service
After=syslog.target
After=network.target
[Service]
Type=simple
User={{ nova_system_user_name }}
Group={{ nova_system_group_name }}
{% if item.program_override is defined %}
ExecStart={{ item.program_override }} {{ item.program_config_options | default('') }} {{ item.log_string | default('--log-file=') }}/var/log/nova/{{ item.service_name }}.log
{% else %}
ExecStart={{ nova_bin }}/{{ item.service_name }} {{ item.program_config_options | default('') }} {{ item.log_string | default('--log-file=') }}/var/log/nova/{{ item.service_name }}.log
{% endif %}
{% if item.service_name != nova_services['nova-novncproxy']['service_name'] and item.service_name != nova_services['nova-spicehtml5proxy']['service_name'] %}
ExecReload={{ (item.wsgi_app is defined and item.wsgi_app) | ternary(nova_bin + '/uwsgi --reload /var/run/' + item.service_name + '/' + item.service_name +'.pid','/bin/kill -HUP $MAINPID') }}
{% 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 nova services will operate from
# The accounting options give us the ability to see resource usage through
# the `systemd-cgtop` command.
Slice=nova.slice
CPUAccounting=true
BlockIOAccounting=true
MemoryAccounting=false
TasksAccounting=true
[Install]
WantedBy=multi-user.target

View File

@ -1,5 +0,0 @@
# {{ ansible_managed }}
D /var/lock/{{ item.service_name }} 2755 {{ nova_system_user_name }} {{ nova_system_group_name }}
D /var/run/{{ item.service_name }} 2755 {{ nova_system_user_name }} {{ nova_system_group_name }}
D {{ nova_lock_path }} 2755 {{ nova_system_user_name }} {{ nova_system_group_name }}