Implement Ubuntu 16.04 Xenial support

This change updates the os_designate role to support Ubuntu 16.04
and systemd in addition to Ubuntu 14.04 and upstart. Changes are
patterned on those made in the os_glance role.

Change-Id: I49b6271a2046b322b9ba57703331ad49aba1bc9d
Implements: blueprint support-ubuntu-1604
This commit is contained in:
Mike Carden 2016-07-12 08:57:27 +10:00
parent e8581c3608
commit cf5bb838e4
10 changed files with 150 additions and 25 deletions

View File

@ -23,6 +23,7 @@ galaxy_info:
- name: Ubuntu
versions:
- trusty
- xenial
categories:
- cloud
- python

View File

@ -0,0 +1,2 @@
features:
- The ``os-designate`` role now supports Ubuntu 16.04 and SystemD.

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- include: designate_upstart_common_init.yml
- include: designate_init_common.yml
vars:
program_name: "{{ designate_api_program_name }}"
service_name: "{{ designate_service_name }}"
@ -24,7 +24,7 @@
tags:
- designate-api-init
- include: designate_upstart_common_init.yml
- include: designate_init_common.yml
vars:
program_name: "{{ designate_central_program_name }}"
service_name: "{{ designate_service_name }}"
@ -35,7 +35,7 @@
tags:
- designate-central-init
- include: designate_upstart_common_init.yml
- include: designate_init_common.yml
vars:
program_name: "{{ designate_pool_manager_program_name }}"
service_name: "{{ designate_service_name }}"
@ -46,7 +46,7 @@
tags:
- designate-pool-manager-init
- include: designate_upstart_common_init.yml
- include: designate_init_common.yml
vars:
program_name: "{{ designate_zone_manager_program_name }}"
service_name: "{{ designate_service_name }}"
@ -57,7 +57,7 @@
tags:
- designate-zone-manager-init
- include: designate_upstart_common_init.yml
- include: designate_init_common.yml
vars:
program_name: "{{ designate_mdns_program_name }}"
service_name: "{{ designate_service_name }}"
@ -68,7 +68,7 @@
tags:
- designate-mdns-init
- include: designate_upstart_common_init.yml
- include: designate_init_common.yml
vars:
program_name: "{{ designate_sink_program_name }}"
service_name: "{{ designate_service_name }}"

View File

@ -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: designate_init_upstart.yml
when: pid1_name == "init"
tags:
- designate-init
- include: designate_init_systemd.yml
when: pid1_name == "systemd"
tags:
- designate-init
- name: Load service
service:
name: "{{ program_name }}"
enabled: "yes"
notify:
- Restart designate services

View File

@ -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 designate TEMP dirs
file:
path: "{{ item.path }}/{{ program_name }}"
state: directory
owner: "{{ system_user }}"
group: "{{ system_group }}"
mode: "02755"
with_items:
- { path: "/var/run" }
- { path: "/var/lock" }
- name: Create tempfile.d entry
template:
src: "designate-systemd-tempfiles.j2"
dest: "/etc/tmpfiles.d/designate.conf"
mode: "0644"
owner: "root"
group: "root"
- name: Place the systemd init script
template:
src: "designate-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 designate services

View File

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

View File

@ -23,11 +23,22 @@
- "{{ ansible_os_family | lower }}.yml"
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: designate_pre_install.yml
- include: designate_install.yml
- include: designate_post_install.yml
- include: designate_upstart_init.yml
- include: designate_init.yml
- include: designate_db_setup.yml
when: >

View File

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

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

@ -0,0 +1,19 @@
# 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
designate_apt_packages: []