cloud kitty upstrart scripts
Adds the upstart scripts for kitty api and kitty processor. It also enables the tasks to restart the services.
This commit is contained in:
parent
76075abf71
commit
fb6ebec971
@ -23,6 +23,7 @@ cloudkitty_system_group_name: cloudkitty
|
||||
cloudkitty_system_user_name: cloudkitty
|
||||
cloudkitty_system_comment: meow
|
||||
cloudkitty_system_shell: /bin/false
|
||||
cloudkitty_system_home_folder: "/var/lib/{{ cloudkitty_system_user_name }}"
|
||||
|
||||
cloudkitty_venv_tag: untagged
|
||||
cloudkitty_venv_bin: "/openstack/venvs/cloudkitty-{{ cloudkitty_venv_tag }}/bin"
|
||||
@ -79,11 +80,15 @@ cloudkitty_service_adminurl: "{{ cloudkitty_service_adminuri }}/v1/%(tenant_id)s
|
||||
cloudkitty_service_internaluri: "{{ cloudkitty_service_internaluri_proto }}://{{ internal_lb_vip_address }}:{{ cloudkitty_service_port }}"
|
||||
cloudkitty_service_internalurl: "{{ cloudkitty_service_internaluri }}/v1/%(tenant_id)s"
|
||||
cloudkitty_service_program_name: cloudkitty-api
|
||||
cloudkitty_service_processor_program_name: cloudkitty-processor
|
||||
|
||||
cloudkitty_cloudkitty_conf_overrides: {}
|
||||
cloudkitty_policy_overrides: {}
|
||||
cloudkitty_api_paste_ini_overrides: {}
|
||||
cloudkitty_service_names: []
|
||||
cloudkitty_service_name: cloudkitty
|
||||
cloudkitty_service_names:
|
||||
- cloudkitty_api
|
||||
- cloudkitty_processor
|
||||
|
||||
cloudkitty_pip_packages:
|
||||
- cloudkitty
|
||||
|
@ -190,8 +190,8 @@
|
||||
when:
|
||||
- cloudkitty_venv_enabled | bool
|
||||
- cloudkitty_get_venv | failed or cloudkitty_developer_mode | bool
|
||||
# notify:
|
||||
# - Restart cloudkitty api
|
||||
notify:
|
||||
- Restart cloudkitty api
|
||||
tags:
|
||||
- cloudkitty-install
|
||||
- cloudkitty-pip-packages
|
||||
@ -209,8 +209,8 @@
|
||||
when:
|
||||
- not cloudkitty_developer_mode | bool
|
||||
- not cloudkitty_venv_enabled | bool
|
||||
# notify:
|
||||
# - Restart cloudkitty api
|
||||
notify:
|
||||
- Restart cloudkitty api
|
||||
tags:
|
||||
- cloudkitty-install
|
||||
- cloudkitty-pip-packages
|
||||
|
46
tasks/cloudkitty_upstart_common_init.yml
Normal file
46
tasks/cloudkitty_upstart_common_init.yml
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
# 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.
|
||||
|
||||
- name: Place the init script
|
||||
template:
|
||||
src: "cloudkitty-upstart-init.j2"
|
||||
dest: "/etc/init/{{ program_name }}.conf"
|
||||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
notify:
|
||||
- Restart cloudkitty services
|
||||
tags:
|
||||
- upstart-init
|
||||
- cloudkitty-init
|
||||
|
||||
- name: Reload init scripts
|
||||
shell: |
|
||||
initctl reload-configuration
|
||||
notify:
|
||||
- Restart cloudkitty services
|
||||
tags:
|
||||
- upstart-init
|
||||
- cloudkitty-init
|
||||
|
||||
- name: Load service
|
||||
service:
|
||||
name: "{{ program_name }}"
|
||||
enabled: "yes"
|
||||
notify:
|
||||
- Restart cloudkitty services
|
||||
tags:
|
||||
- upstart-init
|
||||
- cloudkitty-init
|
34
tasks/cloudkitty_upstart_init.yml
Normal file
34
tasks/cloudkitty_upstart_init.yml
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
# 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.
|
||||
|
||||
- include: cloudkitty_upstart_common_init.yml
|
||||
vars:
|
||||
program_name: "{{ cloudkitty_service_program_name }}"
|
||||
service_name: "{{ cloudkitty_service_name }}"
|
||||
system_user: "{{ cloudkitty_system_user_name }}"
|
||||
system_group: "{{ cloudkitty_system_group_name }}"
|
||||
service_home: "{{ cloudkitty_system_home_folder }}"
|
||||
when: >
|
||||
inventory_hostname in groups['cloudkitty_api']
|
||||
- include: cloudkitty_upstart_common_init.yml
|
||||
vars:
|
||||
program_name: "{{ cloudkitty_service_processor_program_name }}"
|
||||
service_name: "{{ cloudkitty_service_name }}"
|
||||
system_user: "{{ cloudkitty_system_user_name }}"
|
||||
system_group: "{{ cloudkitty_system_group_name }}"
|
||||
service_home: "{{ cloudkitty_system_home_folder }}"
|
||||
when: >
|
||||
inventory_hostname in groups['cloudkitty_api']
|
||||
|
@ -36,7 +36,7 @@
|
||||
when: >
|
||||
inventory_hostname == groups['cloudkitty_all'][0]
|
||||
|
||||
#- include: cloudkitty_upstart_init.yml
|
||||
- include: cloudkitty_upstart_init.yml
|
||||
|
||||
- name: Flush handlers
|
||||
meta: flush_handlers
|
||||
|
44
templates/cloudkitty-upstart-init.j2
Normal file
44
templates/cloudkitty-upstart-init.j2
Normal file
@ -0,0 +1,44 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
description "{{ program_name }}"
|
||||
author "Michae Rice <michael.rice@rackspace.com>"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [016]
|
||||
|
||||
respawn
|
||||
respawn limit 10 5
|
||||
|
||||
# Set the RUNBIN environment variable
|
||||
env RUNBIN="{{ cloudkitty_bin }}/{{ program_name }}"
|
||||
|
||||
# Change directory to service users home
|
||||
chdir "{{ service_home }}"
|
||||
|
||||
# Pre start actions
|
||||
pre-start script
|
||||
mkdir -p "/var/run/{{ program_name }}"
|
||||
chown {{ system_user }}:{{ system_group }} "/var/run/{{ program_name }}"
|
||||
|
||||
mkdir -p "/var/lock/{{ program_name }}"
|
||||
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_name }}"
|
||||
|
||||
{% if cloudkitty_venv_enabled | bool -%}
|
||||
. {{ cloudkitty_venv_bin }}/activate
|
||||
{%- endif %}
|
||||
|
||||
end script
|
||||
|
||||
# Post stop actions
|
||||
post-stop script
|
||||
rm "/var/run/{{ program_name }}/{{ program_name }}.pid"
|
||||
end script
|
||||
|
||||
# Run the start up job
|
||||
exec start-stop-daemon --start \
|
||||
--chuid {{ system_user }} \
|
||||
--make-pidfile \
|
||||
--pidfile /var/run/{{ program_name }}/{{ program_name }}.pid \
|
||||
--exec "{{ program_override|default('$RUNBIN') }}" \
|
||||
-- {{ program_config_options|default('') }} \
|
||||
--log-file=/var/log/cloudkitty/{{ program_name }}.log
|
@ -1,4 +1,3 @@
|
||||
# {{ ansible_managed }}
|
||||
{
|
||||
"context_is_admin": "role:admin",
|
||||
"default": "",
|
||||
|
Loading…
x
Reference in New Issue
Block a user