Use dictionary for service group mappings
Change the 'nova_service_names' from a list to a dictionary mapping of services, groups that install those services. This brings the method into line with that used in the os_neutron role in order to implement a more standardised method. The init tasks have been updated to run once and loop through this mapping rather than being included multiple times and re-run against each host. This may potentially reduce role run times. Currently the reload of upstart/systemd scripts may not happen if only one script changes as the task uses a loop with only one result register. This patch implements handlers to reload upstart/systemd scripts to ensure that this happens when any one of the scripts change. The handler to reload the services now only tries to restart the service if the host is in the group for the service according to the service group mapping. This allows us to ensure that handler failures are no longer ignored and that no execution time is wasted trying to restart services which do not exist on the host. Finally: - Common variables shared by each service's template files have been updated to use the service namespaced variables. - Unused handlers have been removed. - Unused variables have been removed. Change-Id: I53fb0ab1cc5762e3559d4ee2635d4cca532df7e3
This commit is contained in:
parent
2037030f12
commit
9a17ca682d
@ -189,7 +189,6 @@ nova_service_adminuri: "{{ nova_service_adminuri_proto }}://{{ internal_lb_vip_a
|
|||||||
nova_service_adminurl: "{{ nova_service_adminuri }}/v2.1/%(tenant_id)s"
|
nova_service_adminurl: "{{ nova_service_adminuri }}/v2.1/%(tenant_id)s"
|
||||||
nova_service_internaluri: "{{ nova_service_internaluri_proto }}://{{ internal_lb_vip_address }}:{{ nova_service_port }}"
|
nova_service_internaluri: "{{ nova_service_internaluri_proto }}://{{ internal_lb_vip_address }}:{{ nova_service_port }}"
|
||||||
nova_service_internalurl: "{{ nova_service_internaluri }}/v2.1/%(tenant_id)s"
|
nova_service_internalurl: "{{ nova_service_internaluri }}/v2.1/%(tenant_id)s"
|
||||||
nova_program_name: nova-api-os-compute
|
|
||||||
|
|
||||||
## Nova cinder
|
## Nova cinder
|
||||||
nova_cross_az_attach: True
|
nova_cross_az_attach: True
|
||||||
@ -201,7 +200,6 @@ nova_spice_html5proxy_base_uri: "{{ nova_spice_html5proxy_base_proto }}://{{ ext
|
|||||||
nova_spice_html5proxy_base_url: "{{ nova_spice_html5proxy_base_uri }}/spice_auto.html"
|
nova_spice_html5proxy_base_url: "{{ nova_spice_html5proxy_base_uri }}/spice_auto.html"
|
||||||
nova_spice_console_keymap: en-us
|
nova_spice_console_keymap: en-us
|
||||||
nova_spice_console_agent_enabled: True
|
nova_spice_console_agent_enabled: True
|
||||||
nova_spice_program_name: nova-spicehtml5proxy
|
|
||||||
nova_spicehtml5_git_repo: https://github.com/SPICE/spice-html5
|
nova_spicehtml5_git_repo: https://github.com/SPICE/spice-html5
|
||||||
nova_spicehtml5_git_install_branch: master
|
nova_spicehtml5_git_install_branch: master
|
||||||
|
|
||||||
@ -213,7 +211,6 @@ nova_novncproxy_base_url: "{{ nova_novncproxy_base_uri }}/vnc_auto.html"
|
|||||||
nova_novncproxy_vncserver_proxyclient_address: "{{ ansible_host }}"
|
nova_novncproxy_vncserver_proxyclient_address: "{{ ansible_host }}"
|
||||||
nova_novncproxy_vncserver_listen: "{{ ansible_host }}"
|
nova_novncproxy_vncserver_listen: "{{ ansible_host }}"
|
||||||
nova_novncproxy_agent_enabled: True
|
nova_novncproxy_agent_enabled: True
|
||||||
nova_novncproxy_program_name: nova-novncproxy
|
|
||||||
nova_novncproxy_git_repo: https://github.com/kanaka/novnc
|
nova_novncproxy_git_repo: https://github.com/kanaka/novnc
|
||||||
nova_novncproxy_git_install_branch: master
|
nova_novncproxy_git_install_branch: master
|
||||||
nova_novncproxy_vnc_keymap: en-us
|
nova_novncproxy_vnc_keymap: en-us
|
||||||
@ -222,14 +219,9 @@ nova_novncproxy_vnc_keymap: en-us
|
|||||||
nova_metadata_proxy_enabled: "{{ nova_network_services[nova_network_type]['metadata_proxy_enabled'] | bool }}"
|
nova_metadata_proxy_enabled: "{{ nova_network_services[nova_network_type]['metadata_proxy_enabled'] | bool }}"
|
||||||
nova_metadata_host: "{{ internal_lb_vip_address }}"
|
nova_metadata_host: "{{ internal_lb_vip_address }}"
|
||||||
nova_metadata_port: 8775
|
nova_metadata_port: 8775
|
||||||
nova_metadata_program_name: nova-api-metadata
|
|
||||||
|
|
||||||
## Nova cert
|
|
||||||
nova_cert_program_name: nova-cert
|
|
||||||
|
|
||||||
## Nova compute
|
## Nova compute
|
||||||
nova_enable_instance_password: True
|
nova_enable_instance_password: True
|
||||||
nova_compute_program_name: nova-compute
|
|
||||||
nova_force_config_drive: False
|
nova_force_config_drive: False
|
||||||
|
|
||||||
|
|
||||||
@ -242,12 +234,8 @@ nova_libvirt_inject_password: False
|
|||||||
nova_libvirt_disk_cachemodes: '{{ nova_libvirt_images_rbd_pool is defined | ternary("network=writeback", "") }}'
|
nova_libvirt_disk_cachemodes: '{{ nova_libvirt_images_rbd_pool is defined | ternary("network=writeback", "") }}'
|
||||||
nova_libvirt_hw_disk_discard: '{{ nova_libvirt_images_rbd_pool is defined | ternary("unmap", "ignore") }}'
|
nova_libvirt_hw_disk_discard: '{{ nova_libvirt_images_rbd_pool is defined | ternary("unmap", "ignore") }}'
|
||||||
|
|
||||||
## Nova conductor
|
|
||||||
nova_conductor_program_name: nova-conductor
|
|
||||||
|
|
||||||
## Nova console
|
## Nova console
|
||||||
nova_console_agent_enabled: True
|
nova_console_agent_enabled: True
|
||||||
nova_consoleauth_program_name: nova-consoleauth
|
|
||||||
nova_console_keymap: en-us
|
nova_console_keymap: en-us
|
||||||
# Set the console type. Presently the only options are ["spice", "novnc"].
|
# Set the console type. Presently the only options are ["spice", "novnc"].
|
||||||
nova_console_type: spice
|
nova_console_type: spice
|
||||||
@ -325,7 +313,6 @@ nova_scheduler_default_filters: "RetryFilter,AvailabilityZoneFilter,RamFilter,Co
|
|||||||
nova_scheduler_driver: filter_scheduler
|
nova_scheduler_driver: filter_scheduler
|
||||||
nova_scheduler_available_filters: nova.scheduler.filters.all_filters
|
nova_scheduler_available_filters: nova.scheduler.filters.all_filters
|
||||||
nova_scheduler_weight_classes: nova.scheduler.weights.all_weighers
|
nova_scheduler_weight_classes: nova.scheduler.weights.all_weighers
|
||||||
nova_scheduler_program_name: nova-scheduler
|
|
||||||
|
|
||||||
# If you want to regenerate the nova users SSH keys, on each run, set this var to True
|
# If you want to regenerate the nova users SSH keys, on each run, set this var to True
|
||||||
# Otherwise keys will be generated on the first run and not regenerated each run.
|
# Otherwise keys will be generated on the first run and not regenerated each run.
|
||||||
@ -372,17 +359,38 @@ nova_libvirtd_listen_tcp: 0
|
|||||||
nova_libvirtd_auth_tcp: sasl
|
nova_libvirtd_auth_tcp: sasl
|
||||||
nova_libvirtd_debug_log_filters: "3:remote 4:event 3:json 3:rpc"
|
nova_libvirtd_debug_log_filters: "3:remote 4:event 3:json 3:rpc"
|
||||||
|
|
||||||
## Service Names
|
## Service Name-Group Mapping
|
||||||
nova_service_names:
|
nova_services:
|
||||||
- "{{ nova_metadata_program_name }}"
|
nova-api-metadata:
|
||||||
- "{{ nova_cert_program_name }}"
|
group: nova_api_metadata
|
||||||
- "{{ nova_conductor_program_name }}"
|
service_name: nova-api-metadata
|
||||||
- "{{ nova_program_name }}"
|
nova-api-os-compute:
|
||||||
- "{{ nova_scheduler_program_name }}"
|
group: nova_api_os_compute
|
||||||
- "{{ nova_compute_program_name }}"
|
service_name: nova-api-os-compute
|
||||||
- "{{ nova_spice_program_name }}"
|
nova-cert:
|
||||||
- "{{ nova_consoleauth_program_name }}"
|
group: nova_cert
|
||||||
- "{{ nova_novncproxy_program_name }}"
|
service_name: nova-cert
|
||||||
|
nova-compute:
|
||||||
|
group: nova_compute
|
||||||
|
service_name: nova-compute
|
||||||
|
nova-conductor:
|
||||||
|
group: nova_conductor
|
||||||
|
service_name: nova-conductor
|
||||||
|
nova-consoleauth:
|
||||||
|
group: nova_console
|
||||||
|
service_name: nova-consoleauth
|
||||||
|
nova-novncproxy:
|
||||||
|
group: nova_console
|
||||||
|
service_name: nova-novncproxy
|
||||||
|
condition: "{{ nova_console_type == 'novnc' }}"
|
||||||
|
nova-scheduler:
|
||||||
|
group: nova_scheduler
|
||||||
|
service_name: nova-scheduler
|
||||||
|
nova-spicehtml5proxy:
|
||||||
|
group: nova_console
|
||||||
|
service_name: nova-spicehtml5proxy
|
||||||
|
condition: "{{ nova_console_type == 'spice' }}"
|
||||||
|
|
||||||
|
|
||||||
nova_novnc_pip_packages:
|
nova_novnc_pip_packages:
|
||||||
- websockify
|
- websockify
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
# Copyright 2014, Rackspace US, Inc.
|
# Copyright 2015, Rackspace US, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@ -19,10 +19,23 @@
|
|||||||
state: "restarted"
|
state: "restarted"
|
||||||
pattern: "libvirt-bin"
|
pattern: "libvirt-bin"
|
||||||
|
|
||||||
|
- name: Reload systemd daemon
|
||||||
|
command: "systemctl daemon-reload"
|
||||||
|
notify:
|
||||||
|
- Restart nova services
|
||||||
|
|
||||||
|
- name: Reload upstart init scripts
|
||||||
|
shell: |
|
||||||
|
initctl reload-configuration
|
||||||
|
notify:
|
||||||
|
- Restart nova services
|
||||||
|
|
||||||
- name: Restart nova services
|
- name: Restart nova services
|
||||||
service:
|
service:
|
||||||
name: "{{ item }}"
|
name: "{{ item.value.service_name }}"
|
||||||
state: restarted
|
state: "restarted"
|
||||||
pattern: "{{ item }}"
|
pattern: "{{ item.value.service_name }}"
|
||||||
with_items: "{{ nova_service_names }}"
|
with_dict: "{{ nova_services }}"
|
||||||
failed_when: false
|
when:
|
||||||
|
- inventory_hostname in groups[item.value.group]
|
||||||
|
- "{{ item.value.condition | default(true) }}"
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
- include: nova_pre_install.yml
|
- include: nova_pre_install.yml
|
||||||
- include: nova_install.yml
|
- include: nova_install.yml
|
||||||
- include: nova_post_install.yml
|
- include: nova_post_install.yml
|
||||||
- include: nova_init.yml
|
- include: nova_init_common.yml
|
||||||
|
|
||||||
- include: nova_db_setup.yml
|
- include: nova_db_setup.yml
|
||||||
when: inventory_hostname == groups['nova_api_os_compute'][0]
|
when: inventory_hostname == groups['nova_api_os_compute'][0]
|
||||||
|
@ -1,101 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright 2014, 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.
|
|
||||||
|
|
||||||
- include: nova_init_common.yml
|
|
||||||
vars:
|
|
||||||
program_name: "{{ nova_metadata_program_name }}"
|
|
||||||
service_name: "{{ nova_service_name }}"
|
|
||||||
system_user: "{{ nova_system_user_name }}"
|
|
||||||
system_group: "{{ nova_system_group_name }}"
|
|
||||||
service_home: "{{ nova_system_home_folder }}"
|
|
||||||
when: inventory_hostname in groups['nova_api_metadata']
|
|
||||||
|
|
||||||
- include: nova_init_common.yml
|
|
||||||
vars:
|
|
||||||
program_name: "{{ nova_cert_program_name }}"
|
|
||||||
service_name: "{{ nova_service_name }}"
|
|
||||||
system_user: "{{ nova_system_user_name }}"
|
|
||||||
system_group: "{{ nova_system_group_name }}"
|
|
||||||
service_home: "{{ nova_system_home_folder }}"
|
|
||||||
when: inventory_hostname in groups['nova_cert']
|
|
||||||
|
|
||||||
- include: nova_init_common.yml
|
|
||||||
vars:
|
|
||||||
program_name: "{{ nova_conductor_program_name }}"
|
|
||||||
service_name: "{{ nova_service_name }}"
|
|
||||||
system_user: "{{ nova_system_user_name }}"
|
|
||||||
system_group: "{{ nova_system_group_name }}"
|
|
||||||
service_home: "{{ nova_system_home_folder }}"
|
|
||||||
when: inventory_hostname in groups['nova_conductor']
|
|
||||||
|
|
||||||
- include: nova_init_common.yml
|
|
||||||
vars:
|
|
||||||
program_name: "{{ nova_program_name }}"
|
|
||||||
service_name: "{{ nova_service_name }}"
|
|
||||||
system_user: "{{ nova_system_user_name }}"
|
|
||||||
system_group: "{{ nova_system_group_name }}"
|
|
||||||
service_home: "{{ nova_system_home_folder }}"
|
|
||||||
when: inventory_hostname in groups['nova_api_os_compute']
|
|
||||||
|
|
||||||
- include: nova_init_common.yml
|
|
||||||
vars:
|
|
||||||
program_name: "{{ nova_scheduler_program_name }}"
|
|
||||||
service_name: "{{ nova_service_name }}"
|
|
||||||
system_user: "{{ nova_system_user_name }}"
|
|
||||||
system_group: "{{ nova_system_group_name }}"
|
|
||||||
service_home: "{{ nova_system_home_folder }}"
|
|
||||||
when: inventory_hostname in groups['nova_scheduler']
|
|
||||||
|
|
||||||
- include: nova_init_common.yml
|
|
||||||
vars:
|
|
||||||
program_name: "{{ nova_compute_program_name }}"
|
|
||||||
service_name: "{{ nova_service_name }}"
|
|
||||||
system_user: "{{ nova_system_user_name }}"
|
|
||||||
system_group: "{{ nova_system_group_name }}"
|
|
||||||
service_home: "{{ nova_system_home_folder }}"
|
|
||||||
when: inventory_hostname in groups['nova_compute']
|
|
||||||
|
|
||||||
# Upstart init script for spice console.
|
|
||||||
- include: nova_init_common.yml
|
|
||||||
vars:
|
|
||||||
program_name: "{{ nova_spice_program_name }}"
|
|
||||||
service_name: "{{ nova_service_name }}"
|
|
||||||
system_user: "{{ nova_system_user_name }}"
|
|
||||||
system_group: "{{ nova_system_group_name }}"
|
|
||||||
service_home: "{{ nova_system_home_folder }}"
|
|
||||||
when:
|
|
||||||
- inventory_hostname in groups ['nova_console']
|
|
||||||
- nova_console_type == "spice"
|
|
||||||
|
|
||||||
# Upstart init script for novnc console.
|
|
||||||
- include: nova_init_common.yml
|
|
||||||
vars:
|
|
||||||
program_name: "{{ nova_novncproxy_program_name }}"
|
|
||||||
service_name: "{{ nova_service_name }}"
|
|
||||||
system_user: "{{ nova_system_user_name }}"
|
|
||||||
system_group: "{{ nova_system_group_name }}"
|
|
||||||
service_home: "{{ nova_system_home_folder }}"
|
|
||||||
when:
|
|
||||||
- inventory_hostname in groups ['nova_console']
|
|
||||||
- nova_console_type == "novnc"
|
|
||||||
|
|
||||||
- include: nova_init_common.yml
|
|
||||||
vars:
|
|
||||||
program_name: "{{ nova_consoleauth_program_name }}"
|
|
||||||
service_name: "{{ nova_service_name }}"
|
|
||||||
system_user: "{{ nova_system_user_name }}"
|
|
||||||
system_group: "{{ nova_system_group_name }}"
|
|
||||||
service_home: "{{ nova_system_home_folder }}"
|
|
||||||
when: inventory_hostname in groups['nova_console']
|
|
@ -5,7 +5,7 @@
|
|||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
@ -14,24 +14,16 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- include: nova_init_upstart.yml
|
- include: nova_init_upstart.yml
|
||||||
static: no
|
|
||||||
when: pid1_name == "init"
|
when: pid1_name == "init"
|
||||||
tags:
|
|
||||||
- upstart-init
|
|
||||||
- nova-init
|
|
||||||
|
|
||||||
- include: nova_init_systemd.yml
|
- include: nova_init_systemd.yml
|
||||||
static: no
|
|
||||||
when: pid1_name == "systemd"
|
when: pid1_name == "systemd"
|
||||||
tags:
|
|
||||||
- systemd-init
|
|
||||||
- nova-init
|
|
||||||
|
|
||||||
- name: Load service
|
- name: Load service
|
||||||
service:
|
service:
|
||||||
name: "{{ program_name }}"
|
name: "{{ item.value.service_name }}"
|
||||||
enabled: "yes"
|
enabled: "yes"
|
||||||
|
with_dict: "{{ nova_services }}"
|
||||||
|
when: inventory_hostname in groups[item.value.group]
|
||||||
notify:
|
notify:
|
||||||
- Restart nova services
|
- Restart nova services
|
||||||
tags:
|
|
||||||
- nova-init
|
|
||||||
|
@ -15,19 +15,23 @@
|
|||||||
|
|
||||||
- name: Create TEMP run dir
|
- name: Create TEMP run dir
|
||||||
file:
|
file:
|
||||||
path: "/var/run/{{ program_name }}"
|
path: "/var/run/{{ item.value.service_name }}"
|
||||||
state: directory
|
state: directory
|
||||||
owner: "{{ system_user }}"
|
owner: "{{ nova_system_user_name }}"
|
||||||
group: "{{ system_group }}"
|
group: "{{ nova_system_group_name }}"
|
||||||
mode: "02755"
|
mode: "02755"
|
||||||
|
with_dict: "{{ nova_services }}"
|
||||||
|
when: inventory_hostname in groups[item.value.group]
|
||||||
|
|
||||||
- name: Create TEMP lock dir
|
- name: Create TEMP lock dir
|
||||||
file:
|
file:
|
||||||
path: "/var/lock/{{ program_name }}"
|
path: "/var/lock/{{ item.value.service_name }}"
|
||||||
state: directory
|
state: directory
|
||||||
owner: "{{ system_user }}"
|
owner: "{{ nova_system_user_name }}"
|
||||||
group: "{{ system_group }}"
|
group: "{{ nova_system_group_name }}"
|
||||||
mode: "02755"
|
mode: "02755"
|
||||||
|
with_dict: "{{ nova_services }}"
|
||||||
|
when: inventory_hostname in groups[item.value.group]
|
||||||
|
|
||||||
- name: Create tempfile.d entry
|
- name: Create tempfile.d entry
|
||||||
template:
|
template:
|
||||||
@ -36,18 +40,17 @@
|
|||||||
mode: "0644"
|
mode: "0644"
|
||||||
owner: "root"
|
owner: "root"
|
||||||
group: "root"
|
group: "root"
|
||||||
|
with_dict: "{{ nova_services }}"
|
||||||
|
when: inventory_hostname in groups[item.value.group]
|
||||||
|
|
||||||
- name: Place the systemd init script
|
- name: Place the systemd init script
|
||||||
template:
|
template:
|
||||||
src: "nova-systemd-init.j2"
|
src: "nova-systemd-init.j2"
|
||||||
dest: "/etc/systemd/system/{{ program_name }}.service"
|
dest: "/etc/systemd/system/{{ item.value.service_name }}.service"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
owner: "root"
|
owner: "root"
|
||||||
group: "root"
|
group: "root"
|
||||||
register: systemd_init
|
with_dict: "{{ nova_services }}"
|
||||||
|
when: inventory_hostname in groups[item.value.group]
|
||||||
- name: Reload the systemd daemon
|
|
||||||
command: "systemctl daemon-reload"
|
|
||||||
when: systemd_init | changed
|
|
||||||
notify:
|
notify:
|
||||||
- Restart nova services
|
- Reload systemd daemon
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
# Copyright 2014, Rackspace US, Inc.
|
# Copyright 2015, Rackspace US, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@ -16,21 +16,11 @@
|
|||||||
- name: Place the init script
|
- name: Place the init script
|
||||||
template:
|
template:
|
||||||
src: "nova-upstart-init.j2"
|
src: "nova-upstart-init.j2"
|
||||||
dest: "/etc/init/{{ program_name }}.conf"
|
dest: "/etc/init/{{ item.value.service_name }}.conf"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
owner: "root"
|
owner: "root"
|
||||||
group: "root"
|
group: "root"
|
||||||
|
with_dict: "{{ nova_services }}"
|
||||||
|
when: inventory_hostname in groups[item.value.group]
|
||||||
notify:
|
notify:
|
||||||
- Restart nova services
|
- Reload upstart init scripts
|
||||||
tags:
|
|
||||||
- upstart-init
|
|
||||||
- nova-init
|
|
||||||
|
|
||||||
- name: Reload init scripts
|
|
||||||
shell: |
|
|
||||||
initctl reload-configuration
|
|
||||||
notify:
|
|
||||||
- Restart nova services
|
|
||||||
tags:
|
|
||||||
- upstart-init
|
|
||||||
- nova-init
|
|
||||||
|
@ -7,13 +7,13 @@ After=network.target
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User={{ system_user }}
|
User={{ nova_system_user_name }}
|
||||||
Group={{ system_group }}
|
Group={{ nova_system_group_name }}
|
||||||
|
|
||||||
{% if program_override is defined %}
|
{% if program_override is defined %}
|
||||||
ExecStart={{ program_override }} {{ program_config_options|default('') }} --log-file=/var/log/nova/{{ program_name }}.log
|
ExecStart={{ program_override }} {{ program_config_options|default('') }} --log-file=/var/log/nova/{{ item.value.service_name }}.log
|
||||||
{% else %}
|
{% else %}
|
||||||
ExecStart={{ nova_bin }}/{{ program_name }} {{ program_config_options|default('') }} --log-file=/var/log/nova/{{ program_name }}.log
|
ExecStart={{ nova_bin }}/{{ item.value.service_name }} {{ program_config_options|default('') }} --log-file=/var/log/nova/{{ item.value.service_name }}.log
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# Give a reasonable amount of time for the server to start up/shut down
|
# Give a reasonable amount of time for the server to start up/shut down
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
D /var/lock/{{ program_name }} 2755 {{ system_user }} {{ system_group }}
|
D /var/lock/{{ item.value.service_name }} 2755 {{ nova_system_user_name }} {{ nova_system_group_name }}
|
||||||
D /var/run/{{ program_name }} 2755 {{ system_user }} {{ system_group }}
|
D /var/run/{{ item.value.service_name }} 2755 {{ nova_system_user_name }} {{ nova_system_group_name }}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
description "{{ program_name }}"
|
|
||||||
|
description "{{ item.value.service_name }}"
|
||||||
author "Kevin Carter <kevin.carter@rackspace.com>"
|
author "Kevin Carter <kevin.carter@rackspace.com>"
|
||||||
|
|
||||||
start on runlevel [2345]
|
start on runlevel [2345]
|
||||||
@ -10,18 +11,18 @@ respawn
|
|||||||
respawn limit 10 5
|
respawn limit 10 5
|
||||||
|
|
||||||
# Set the RUNBIN environment variable
|
# Set the RUNBIN environment variable
|
||||||
env RUNBIN="{{ nova_bin }}/{{ program_name }}"
|
env RUNBIN="{{ nova_bin }}/{{ item.value.service_name }}"
|
||||||
|
|
||||||
# Change directory to service users home
|
# Change directory to service users home
|
||||||
chdir "{{ service_home }}"
|
chdir "{{ nova_system_home_folder }}"
|
||||||
|
|
||||||
# Pre start actions
|
# Pre start actions
|
||||||
pre-start script
|
pre-start script
|
||||||
mkdir -p "/var/run/{{ program_name }}"
|
mkdir -p "/var/run/{{ item.value.service_name }}"
|
||||||
chown {{ system_user }}:{{ system_group }} "/var/run/{{ program_name }}"
|
chown {{ nova_system_user_name }}:{{ nova_system_group_name }} "/var/run/{{ item.value.service_name }}"
|
||||||
|
|
||||||
mkdir -p "/var/lock/{{ program_name }}"
|
mkdir -p "/var/lock/{{ item.value.service_name }}"
|
||||||
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_name }}"
|
chown {{ nova_system_user_name }}:{{ nova_system_group_name }} "/var/lock/{{ item.value.service_name }}"
|
||||||
|
|
||||||
. {{ nova_bin }}/activate
|
. {{ nova_bin }}/activate
|
||||||
|
|
||||||
@ -29,14 +30,15 @@ end script
|
|||||||
|
|
||||||
# Post stop actions
|
# Post stop actions
|
||||||
post-stop script
|
post-stop script
|
||||||
rm "/var/run/{{ program_name }}/{{ program_name }}.pid"
|
rm "/var/run/{{ item.value.service_name }}/{{ item.value.service_name }}.pid"
|
||||||
end script
|
end script
|
||||||
|
|
||||||
# Run the start up job
|
# Run the start up job
|
||||||
exec start-stop-daemon --start \
|
exec start-stop-daemon --start \
|
||||||
--chuid {{ system_user }} \
|
--chuid {{ nova_system_user_name }} \
|
||||||
--make-pidfile \
|
--make-pidfile \
|
||||||
--pidfile /var/run/{{ program_name }}/{{ program_name }}.pid \
|
--pidfile /var/run/{{ item.value.service_name }}/{{ item.value.service_name }}.pid \
|
||||||
--exec "{{ program_override|default('$RUNBIN') }}" \
|
--exec "{{ program_override|default('$RUNBIN') }}" \
|
||||||
-- {{ program_config_options|default('') }} \
|
-- {{ program_config_options|default('') }} \
|
||||||
--log-file=/var/log/nova/{{ program_name }}.log
|
--log-file=/var/log/{{ nova_service_name }}/{{ item.value.service_name }}.log
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user