Implement Ubuntu 16.04 support with SystemD
This change updates the aodh role to support Ubuntu 14.04 with upstart init and 16.04 with a systemd init. Some tags for tasks are updated to conform to convention as well. Change-Id: Ice81e049475b31559c861c0d20bcd26867da321c Implements: blueprint support-ubuntu-1604
This commit is contained in:
parent
6ebc7b4f6d
commit
be906077f9
|
@ -23,6 +23,7 @@ galaxy_info:
|
|||
- name: Ubuntu
|
||||
versions:
|
||||
- trusty
|
||||
- xenial
|
||||
categories:
|
||||
- cloud
|
||||
- python
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
feature:
|
||||
- Support has been added to deploy Aodh services for Ubuntu 16.04 LTS.
|
|
@ -0,0 +1,58 @@
|
|||
---
|
||||
# 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: aodh_init_common.yml
|
||||
vars:
|
||||
program_name: "{{ aodh_alarm_notifier_program_name }}"
|
||||
service_name: "{{ aodh_service_name }}"
|
||||
system_user: "{{ aodh_system_user_name }}"
|
||||
system_group: "{{ aodh_system_group_name }}"
|
||||
service_home: "{{ aodh_system_user_home }}"
|
||||
when: inventory_hostname in groups['aodh_alarm_notifier']
|
||||
tags:
|
||||
- aodh-notifier-init
|
||||
|
||||
- include: aodh_init_common.yml
|
||||
vars:
|
||||
program_name: "{{ aodh_alarm_evaluator_program_name }}"
|
||||
service_name: "{{ aodh_service_name }}"
|
||||
system_user: "{{ aodh_system_user_name }}"
|
||||
system_group: "{{ aodh_system_group_name }}"
|
||||
service_home: "{{ aodh_system_user_home }}"
|
||||
when: inventory_hostname in groups['aodh_alarm_evaluator']
|
||||
tags:
|
||||
- aodh-evaluator-init
|
||||
|
||||
- include: aodh_init_common.yml
|
||||
vars:
|
||||
program_name: "{{ aodh_api_program_name }}"
|
||||
service_name: "{{ aodh_service_name }}"
|
||||
system_user: "{{ aodh_system_user_name }}"
|
||||
system_group: "{{ aodh_system_group_name }}"
|
||||
service_home: "{{ aodh_system_user_home }}"
|
||||
when: inventory_hostname in groups['aodh_api']
|
||||
tags:
|
||||
- aodh-api-init
|
||||
|
||||
- include: aodh_init_common.yml
|
||||
vars:
|
||||
program_name: "{{ aodh_listener_program_name }}"
|
||||
service_name: "{{ aodh_service_name }}"
|
||||
system_user: "{{ aodh_system_user_name }}"
|
||||
system_group: "{{ aodh_system_group_name }}"
|
||||
service_home: "{{ aodh_system_user_home }}"
|
||||
when: inventory_hostname in groups['aodh_listener']
|
||||
tags:
|
||||
- aodh-listener-init
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
# 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: aodh_init_upstart.yml
|
||||
when: pid1_name == "init"
|
||||
tags:
|
||||
- aodh-init
|
||||
|
||||
- include: aodh_init_systemd.yml
|
||||
when: pid1_name == "systemd"
|
||||
tags:
|
||||
- aodh-init
|
||||
|
||||
- name: Load service
|
||||
service:
|
||||
name: "{{ program_name }}"
|
||||
enabled: "yes"
|
||||
notify:
|
||||
- Restart aodh services
|
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
# 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 aodh TEMP dirs
|
||||
file:
|
||||
path: "{{ item.path }}/{{ program_name }}"
|
||||
state: directory
|
||||
owner: "{{ system_user }}"
|
||||
group: "{{ system_group }}"
|
||||
mode: "2755"
|
||||
with_items:
|
||||
- { path: "/var/run" }
|
||||
- { path: "/var/lock" }
|
||||
|
||||
- name: Create tempfile.d entry
|
||||
template:
|
||||
src: "aodh-systemd-tempfiles.j2"
|
||||
dest: "/etc/tmpfiles.d/aodh.conf"
|
||||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
|
||||
- name: Place the systemd init script
|
||||
template:
|
||||
src: "aodh-systemd-init.j2"
|
||||
dest: "/etc/systemd/system/{{ program_name }}.service"
|
||||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
register: systemd_init
|
||||
|
||||
- name: Reload the systemd daemon
|
||||
command: "systemctl daemon-reload"
|
||||
when: systemd_init | changed
|
||||
notify:
|
||||
- Restart aodh services
|
|
@ -20,6 +20,7 @@
|
|||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
register: upstart_init
|
||||
notify:
|
||||
- Restart aodh services
|
||||
tags:
|
||||
|
@ -29,6 +30,7 @@
|
|||
- name: Reload init scripts
|
||||
shell: |
|
||||
initctl reload-configuration
|
||||
register: upstart_init
|
||||
notify:
|
||||
- Restart aodh services
|
||||
tags:
|
|
@ -21,6 +21,18 @@
|
|||
tags:
|
||||
- always
|
||||
|
||||
- name: Check init system
|
||||
command: cat /proc/1/comm
|
||||
register: _pid1_name
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: Set the name of pid1
|
||||
set_fact:
|
||||
pid1_name: "{{ _pid1_name.stdout }}"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
|
@ -33,14 +45,30 @@
|
|||
- always
|
||||
|
||||
- include: aodh_pre_install.yml
|
||||
tags:
|
||||
- aodh-install
|
||||
|
||||
- include: aodh_install.yml
|
||||
tags:
|
||||
- aodh-install
|
||||
- aodh-config
|
||||
|
||||
- include: aodh_post_install.yml
|
||||
- include: aodh_upstart_init.yml
|
||||
tags:
|
||||
- aodh-install
|
||||
|
||||
- include: aodh_init.yml
|
||||
tags:
|
||||
- aodh-install
|
||||
|
||||
- include: aodh_db_setup.yml
|
||||
when: >
|
||||
inventory_hostname == groups['aodh_all'][0]
|
||||
tags:
|
||||
- aodh-install
|
||||
|
||||
- include: aodh_service_setup.yml
|
||||
when: >
|
||||
inventory_hostname == groups['aodh_api'][0]
|
||||
tags:
|
||||
- aodh-install
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description=aodh openstack service
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User={{ system_user }}
|
||||
Group={{ system_group }}
|
||||
|
||||
{% if program_override is defined %}
|
||||
ExecStart={{ program_override }} {{ program_config_options|default('') }} --log-file=/var/log/aodh/{{ program_name }}.log
|
||||
{% else %}
|
||||
ExecStart={{ aodh_bin }}/{{ program_name }} {{ program_config_options|default('') }} --log-file=/var/log/aodh/{{ program_name }}.log
|
||||
{% endif %}
|
||||
|
||||
# Give a reasonable amount of time for the server to start up/shut down
|
||||
TimeoutSec=300
|
||||
Restart=on-failure
|
||||
RestartSec=150
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,4 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
D /var/lock/{{ program_name }} 2755 {{ system_user }} {{ system_group }}
|
||||
D /var/run/{{ program_name }} 2755 {{ system_user }} {{ system_group }}
|
Loading…
Reference in New Issue