Phase out trusty and use systemd

We don't support trusty in master anymore, so this makes sures the
support of upstart is phased out.

Whenever possible, we use the systemd module instead, that reduces the
amount of tasks.

Change-Id: I50d377ce6c5e80386954fd551e566c55f57c5a3a
Signed-off-by: Jean-Philippe Evrard <jean-philippe.evrard@rackspace.co.uk>
This commit is contained in:
Jean-Philippe Evrard 2017-01-20 09:21:19 +00:00
parent 074ae8281b
commit 3b6300f3ce
6 changed files with 9 additions and 87 deletions

View File

@ -13,20 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Reload systemd daemon
command: "systemctl daemon-reload"
notify:
- Restart cloudkitty services
- name: Reload upstart init scripts
command: initctl reload-configuration
notify:
- Restart cloudkitty services
- name: Restart cloudkitty services
service:
systemd:
name: "{{ item.value.service_name }}"
state: "restarted"
pattern: "{{ item.value.service_name }}"
daemon_reload: yes
with_dict: "{{ cloudkitty_services }}"
when: inventory_hostname in groups[item.value.group]

View File

@ -0,0 +1,4 @@
---
other:
- Ubuntu Trusty (14.04) support is now removed from
the os_cloudkitty role.

View File

@ -13,16 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- include: cloudkitty_init_upstart.yml
when: pid1_name == "init"
- include: cloudkitty_init_systemd.yml
when: pid1_name == "systemd"
- name: Load service
service:
systemd:
name: "{{ item.value.service_name }}"
enabled: "yes"
daemon_reload: yes
with_dict: "{{ cloudkitty_services }}"
when: inventory_hostname in groups[item.value.group]
notify:

View File

@ -53,4 +53,4 @@
with_dict: "{{ cloudkitty_services }}"
when: inventory_hostname in groups[item.value.group]
notify:
- Reload systemd daemon
- Restart cloudkitty services

View File

@ -1,26 +0,0 @@
---
# Copyright 2015, 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/{{ item.value.service_name }}.conf"
mode: "0644"
owner: "root"
group: "root"
with_dict: "{{ cloudkitty_services }}"
when: inventory_hostname in groups[item.value.group]
notify:
- Reload upstart init scripts

View File

@ -1,44 +0,0 @@
# {{ ansible_managed }}
description "{{ item.value.service_name }}"
author "Kevin Carter <kevin.carter@rackspace.com>"
start on runlevel [2345]
stop on runlevel [016]
respawn
respawn limit 10 5
# Set the RUNBIN environment variable
env RUNBIN="{{ cloudkitty_bin }}/{{ item.value.service_name }}"
# Change directory to service users home
chdir "{{ cloudkitty_system_home_folder }}"
# Pre start actions
pre-start script
mkdir -p "/var/run/{{ item.value.service_name }}"
chown {{ cloudkitty_system_user_name }}:{{ cloudkitty_system_group_name }} "/var/run/{{ item.value.service_name }}"
mkdir -p "/var/lock/{{ item.value.service_name }}"
chown {{ cloudkitty_system_user_name }}:{{ cloudkitty_system_group_name }} "/var/lock/{{ item.value.service_name }}"
. {{ cloudkitty_bin }}/activate
end script
# Post stop actions
post-stop script
rm "/var/run/{{ item.value.service_name }}/{{ item.value.service_name }}.pid"
end script
# Run the start up job
exec start-stop-daemon --start \
--chuid {{ cloudkitty_system_user_name }} \
--make-pidfile \
--pidfile /var/run/{{ item.value.service_name }}/{{ item.value.service_name }}.pid \
--exec "{{ program_override|default('$RUNBIN') }}" \
-- {{ program_config_options|default('') }} \
--log-file=/var/log/{{ cloudkitty_service_name }}/{{ item.value.service_name }}.log