Implement Ubuntu 16.04 support with SystemD
This change updates the glance role to support Ubuntu 14.04 with upstart init and 16.04 with a systemd init. Implements: blueprint support-ubuntu-1604 Depends-On: Ib6d7e68133de8d10b81d9116b74dca1de7568897 Change-Id: I39214199e2bbc2bbc5c1b30f8a04aa4e74ed967b Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
a5ed9f44f5
commit
24c3d7053e
@ -23,6 +23,7 @@ galaxy_info:
|
|||||||
- name: Ubuntu
|
- name: Ubuntu
|
||||||
versions:
|
versions:
|
||||||
- trusty
|
- trusty
|
||||||
|
- xenial
|
||||||
categories:
|
categories:
|
||||||
- cloud
|
- cloud
|
||||||
- python
|
- python
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- The ``os_glance`` role now supports Ubuntu 16.04 and SystemD.
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
# Copyright 2014, Rackspace US, Inc.
|
# Copyright 2016, Rackspace US, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@ -13,7 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- include: glance_upstart_common_init.yml
|
- include: glance_init_common.yml
|
||||||
vars:
|
vars:
|
||||||
program_name: "{{ glance_api_program_name }}"
|
program_name: "{{ glance_api_program_name }}"
|
||||||
service_name: "{{ glance_service_name }}"
|
service_name: "{{ glance_service_name }}"
|
||||||
@ -21,7 +21,7 @@
|
|||||||
system_group: "{{ glance_system_group_name }}"
|
system_group: "{{ glance_system_group_name }}"
|
||||||
service_home: "{{ glance_system_user_home }}"
|
service_home: "{{ glance_system_user_home }}"
|
||||||
|
|
||||||
- include: glance_upstart_common_init.yml
|
- include: glance_init_common.yml
|
||||||
vars:
|
vars:
|
||||||
program_name: "{{ glance_registry_program_name }}"
|
program_name: "{{ glance_registry_program_name }}"
|
||||||
service_name: "{{ glance_service_name }}"
|
service_name: "{{ glance_service_name }}"
|
31
tasks/glance_init_common.yml
Normal file
31
tasks/glance_init_common.yml
Normal 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: glance_init_upstart.yml
|
||||||
|
when: pid1_name == "init"
|
||||||
|
tags:
|
||||||
|
- glance-init
|
||||||
|
|
||||||
|
- include: glance_init_systemd.yml
|
||||||
|
when: pid1_name == "systemd"
|
||||||
|
tags:
|
||||||
|
- glance-init
|
||||||
|
|
||||||
|
- name: Load service
|
||||||
|
service:
|
||||||
|
name: "{{ program_name }}"
|
||||||
|
enabled: "yes"
|
||||||
|
notify:
|
||||||
|
- Restart glance services
|
48
tasks/glance_init_systemd.yml
Normal file
48
tasks/glance_init_systemd.yml
Normal 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 glance 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: "glance-systemd-tempfiles.j2"
|
||||||
|
dest: "/etc/tmpfiles.d/glance.conf"
|
||||||
|
mode: "0644"
|
||||||
|
owner: "root"
|
||||||
|
group: "root"
|
||||||
|
|
||||||
|
- name: Place the systemd init script
|
||||||
|
template:
|
||||||
|
src: "glance-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 glance services
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
# Copyright 2014, Rackspace US, Inc.
|
# Copyright 2016, Rackspace US, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@ -20,27 +20,13 @@
|
|||||||
mode: "0644"
|
mode: "0644"
|
||||||
owner: "root"
|
owner: "root"
|
||||||
group: "root"
|
group: "root"
|
||||||
|
register: upstart_init
|
||||||
notify:
|
notify:
|
||||||
- Restart glance services
|
- Restart glance services
|
||||||
tags:
|
|
||||||
- upstart-init
|
|
||||||
- glance-init
|
|
||||||
|
|
||||||
- name: Reload init scripts
|
- name: Reload init scripts
|
||||||
shell: |
|
shell: |
|
||||||
initctl reload-configuration
|
initctl reload-configuration
|
||||||
|
when: upstart_init | changed
|
||||||
notify:
|
notify:
|
||||||
- Restart glance services
|
- Restart glance services
|
||||||
tags:
|
|
||||||
- upstart-init
|
|
||||||
- glance-init
|
|
||||||
|
|
||||||
- name: Load service
|
|
||||||
service:
|
|
||||||
name: "{{ program_name }}"
|
|
||||||
enabled: "yes"
|
|
||||||
notify:
|
|
||||||
- Restart glance services
|
|
||||||
tags:
|
|
||||||
- upstart-init
|
|
||||||
- glance-init
|
|
@ -22,10 +22,22 @@
|
|||||||
tags:
|
tags:
|
||||||
- always
|
- 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: glance_pre_install.yml
|
- include: glance_pre_install.yml
|
||||||
- include: glance_install.yml
|
- include: glance_install.yml
|
||||||
- include: glance_post_install.yml
|
- include: glance_post_install.yml
|
||||||
- include: glance_upstart_init.yml
|
- include: glance_init.yml
|
||||||
|
|
||||||
- include: glance_db_setup.yml
|
- include: glance_db_setup.yml
|
||||||
when: >
|
when: >
|
||||||
|
25
templates/glance-systemd-init.j2
Normal file
25
templates/glance-systemd-init.j2
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=glance 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/glance/{{ program_name }}.log
|
||||||
|
{% else %}
|
||||||
|
ExecStart={{ glance_bin }}/{{ program_name }} {{ program_config_options|default('') }} --log-file=/var/log/glance/{{ 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
|
4
templates/glance-systemd-tempfiles.j2
Normal file
4
templates/glance-systemd-tempfiles.j2
Normal 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 }}
|
23
vars/ubuntu-16.04.yml
Normal file
23
vars/ubuntu-16.04.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# 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
|
||||||
|
glance_apt_packages:
|
||||||
|
- rpcbind
|
||||||
|
- rsync
|
||||||
|
- git
|
||||||
|
- nfs-common
|
Loading…
Reference in New Issue
Block a user