Implement Xenial Support

This commit adds support for Ubuntu 16.04.
Primarily, this commit consists of changes
necessary to support systemd.

Change-Id: Ide0d570b508be8efaa885431598c726d7baad4f6
This commit is contained in:
Michael Gugino 2016-06-27 11:47:15 -04:00
parent 288500cdf1
commit d0c001c5e6
11 changed files with 161 additions and 32 deletions

View File

@ -0,0 +1,4 @@
---
feature:
- Support has been added to deploy the swift services on Ubuntu 16.04
LTS.

View File

@ -13,6 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Detect whether the init system is upstart of systemd.
- 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:

View File

@ -0,0 +1,35 @@
---
# 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: swift_init_upstart.yml
when: pid1_name == "init"
tags:
- upstart-init
- swift-init
- include: swift_init_systemd.yml
when: pid1_name == "systemd"
tags:
- systemd-init
- swift-init
- name: Load service
service:
name: "{{ program_name }}"
enabled: "yes"
state: restarted
when: init_script|changed
tags:
- swift-init

View File

@ -0,0 +1,58 @@
---
# 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: Create swift 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" }
tags:
- systemd-init
- swift-init
- name: Create tempfile.d entry
template:
src: "swift-systemd-tempfiles.j2"
dest: "/etc/tmpfiles.d/swift.conf"
mode: "0644"
owner: "root"
group: "root"
tags:
- systemd-init
- swift-init
- name: Place the systemd init script
template:
src: "swift-systemd-init.j2"
dest: "/etc/systemd/system/{{ program_name }}.service"
mode: "0644"
owner: "root"
group: "root"
register: init_script
tags:
- systemd-init
- swift-init
- name: Reload the systemd daemon
command: "systemctl daemon-reload"
when: init_script | changed
tags:
- systemd-init
- swift-init

View File

@ -32,13 +32,3 @@
tags:
- upstart-init
- swift-init
- name: Load service
service:
name: "{{ program_name }}"
enabled: "yes"
state: restarted
when: init_script|changed
tags:
- upstart-init
- swift-init

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-proxy-server"
program_config_options: "{{ swift_proxy_server_program_config_options }}"

View File

@ -14,7 +14,7 @@
# limitations under the License.
# When not using a replication network use the default configuration
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-account-replicator"
program_config_options: "{{ swift_account_server_program_config_options }}"
@ -27,7 +27,7 @@
swift.replication_network == swift.storage_network
# When using a replication network use the specific replicator configuration
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-account-replicator"
program_config_options: "{{ swift_account_replicator_program_config_options }}"
@ -42,7 +42,7 @@
# When using a replication network use a second server for dedicated replicator configuration
# This will be a blank file if not using dedicated replication network to prevent errors
# when the service attempts to start.
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-account-replicator-server"
program_binary: "swift-account-server"
@ -52,7 +52,7 @@
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-account-server"
program_config_options: "{{ swift_account_server_program_config_options }}"
@ -61,7 +61,7 @@
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-account-auditor"
program_config_options: "{{ swift_account_server_program_config_options }}"
@ -70,7 +70,7 @@
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-account-reaper"
program_config_options: "{{ swift_account_server_program_config_options }}"

View File

@ -14,7 +14,7 @@
# limitations under the License.
# When not using a replication network use the default configuration
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-container-replicator"
program_config_options: "{{ swift_container_server_program_config_options }}"
@ -27,7 +27,7 @@
swift.replication_network == swift.storage_network
# When using a replication network use the specific replicator configuration
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-container-replicator"
program_config_options: "{{ swift_container_replicator_program_config_options }}"
@ -42,7 +42,7 @@
# When using a replication network create a second server for dedicated replicator configuration
# This will be a blank file if not using dedicated replication network to prevent errors
# when the service attempts to start.
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-container-replicator-server"
program_binary: "swift-container-server"
@ -52,7 +52,7 @@
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-container-server"
program_config_options: "{{ swift_container_server_program_config_options }}"
@ -61,7 +61,7 @@
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-container-auditor"
program_config_options: "{{ swift_container_server_program_config_options }}"
@ -70,7 +70,7 @@
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-container-sync"
program_config_options: "{{ swift_container_server_program_config_options }}"
@ -79,7 +79,7 @@
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-container-updater"
program_config_options: "{{ swift_container_server_program_config_options }}"
@ -88,7 +88,7 @@
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-container-reconciler"
program_config_options: "{{ swift_container_reconciler_program_config_options }}"

View File

@ -14,7 +14,7 @@
# limitations under the License.
# When not using a replication network use the default configuration
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-object-replicator"
program_config_options: "{{ swift_object_server_program_config_options }}"
@ -27,7 +27,7 @@
swift.replication_network == swift.storage_network
# When using a replication network use the specific replicator configuration
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-object-replicator"
program_config_options: "{{ swift_object_replicator_program_config_options }}"
@ -42,7 +42,7 @@
# When using a replication network use a second server for dedicated replicator configuration
# This will be a blank file if not using dedicated replication network to prevent errors
# when the service attempts to start.
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-object-replicator-server"
program_binary: "swift-object-server"
@ -52,7 +52,7 @@
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-object-server"
program_config_options: "{{ swift_object_server_program_config_options }}"
@ -61,7 +61,7 @@
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-object-auditor"
program_config_options: "{{ swift_object_server_program_config_options }}"
@ -70,7 +70,7 @@
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-object-updater"
program_config_options: "{{ swift_object_server_program_config_options }}"
@ -79,7 +79,7 @@
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
- include: swift_upstart_common_init.yml
- include: swift_init_common.yml
vars:
program_name: "swift-object-expirer"
program_config_options: "{{ swift_object_expirer_program_config_options }}"

View File

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