Implement Ubuntu 16.04 Xenial support

This change adds suport for Ubuntu 16.04 with SystemD
while keeping the support for Ubuntu 14.04 with upstart.

Implements: blueprint support-ubuntu-1604
Change-Id: Iffed984d6c2c881cbac31919dc805b6122dd4f3f
This commit is contained in:
Flávio Ramalho 2016-06-15 23:14:58 -03:00
parent ab8e63432c
commit c5ecb56867
10 changed files with 149 additions and 22 deletions

View File

@ -1,14 +1,15 @@
---
galaxy_info:
author: flaviodsr
author: flaviodsr
description: Installation and setup of sahara
company: LSD/UFCG
license: Apache2
min_ansible_version: 1.6.6
min_ansible_version: 1.9.4
platforms:
- name: Ubuntu
versions:
- trusty
- xenial
categories:
- cloud
- python

View File

@ -20,10 +20,22 @@
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
- include: sahara_pre_install.yml
- include: sahara_install.yml
- include: sahara_post_install.yml
- include: sahara_upstart_init.yml
- include: sahara_init.yml
- include: sahara_db_setup.yml
when: >

View File

@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- include: sahara_upstart_common_init.yml
- include: sahara_init_common.yml
vars:
program_name: "{{ sahara_api_program_name }}"
service_name: "{{ sahara_service_name }}"
@ -19,7 +19,7 @@
system_group: "{{ sahara_system_group_name }}"
service_home: "{{ sahara_system_user_home }}"
- include: sahara_upstart_common_init.yml
- include: sahara_init_common.yml
vars:
program_name: "{{ sahara_engine_program_name }}"
service_name: "{{ sahara_service_name }}"

View File

@ -0,0 +1,29 @@
---
# 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: sahara_init_upstart.yml
when: pid1_name == "init"
tags:
- sahara-init
- include: sahara_init_systemd.yml
when: pid1_name == "systemd"
tags:
- sahara-init
- name: Load service
service:
name: "{{ program_name }}"
enabled: "yes"
notify:
- Restart sahara services

View File

@ -0,0 +1,49 @@
---
# 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 sahara 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: "sahara-systemd-tempfiles.j2"
dest: "/etc/tmpfiles.d/sahara.conf"
mode: "0644"
owner: "root"
group: "root"
- name: Place the systemd init script
template:
src: "sahara-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 sahara services

View File

@ -18,27 +18,13 @@
mode: "0644"
owner: "root"
group: "root"
register: upstart_init
notify:
- Restart sahara services
tags:
- upstart-init
- sahara-init
- name: Reload init scripts
shell: |
initctl reload-configuration
when: upstart_init | changed
notify:
- Restart sahara services
tags:
- upstart-init
- sahara-init
- name: Load service
service:
name: "{{ program_name }}"
enabled: "yes"
notify:
- Restart sahara services
tags:
- upstart-init
- sahara-init

View File

@ -0,0 +1,25 @@
# {{ ansible_managed }}
[Unit]
Description=sahara 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/sahara/{{ program_name }}.log
{% else %}
ExecStart={{ sahara_bin }}/{{ program_name }} {{ program_config_options|default('') }} --log-file=/var/log/sahara/{{ 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

View File

@ -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 }}

View File

@ -20,4 +20,3 @@ sahara_apt_packages:
- rpcbind
- rsync
- git
- nfs-common

22
vars/ubuntu-16.04.yml Normal file
View File

@ -0,0 +1,22 @@
# Copyright 2016, Intel Corporation.
#
# 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.
## APT Cache options
cache_timeout: 600
# Common apt packages
sahara_apt_packages:
- rpcbind
- rsync
- git