
The files and templates we carry are almost always in a state of maintenance. The upstream services are maintaining these files and there's really no reason we need to carry duplicate copies of them. This change removes all of the files we expect to get from the upstream service. while the focus of this change is to remove configuration file maintenance burdens it also allows the role to execute faster. * Source installs have the configuration files within the venv at "<<VENV_PATH>>/etc/<<SERVICE_NAME>>". The role will now link the default configuration path to this directory. When the service is upgraded the link will move to the new venv path. * Distro installs package all of the required configuration files. To maintain our current capabilities to override configuration the role will fetch files from the disk whenever an override is provided and then push the fetched file back to the target using `config_template`. Change-Id: I3e7283bf778a9d686f3ae500b289c1fb43b42b92 Signed-off-by: cloudnull <kevin@cloudnull.com>
103 lines
3.4 KiB
YAML
103 lines
3.4 KiB
YAML
---
|
|
# Copyright 2015, 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: Stop services
|
|
service:
|
|
name: "{{ item.service_name }}"
|
|
enabled: yes
|
|
state: "stopped"
|
|
daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}"
|
|
with_items: "{{ filtered_glance_services }}"
|
|
register: _stop
|
|
until: _stop is success
|
|
retries: 5
|
|
delay: 2
|
|
listen:
|
|
- "Restart glance services"
|
|
- "venv changed"
|
|
|
|
# TODO(odyssey4me):
|
|
# Assuming glance-registry is removed in the S cycle as planned, this
|
|
# task can be removed in the T cycle.
|
|
# Note that this uses shell task because the unit may not exist. When it
|
|
# does not exist, the ansible task which stops/disables it fails and it
|
|
# is important that we see failures, but get failures in the right
|
|
# circumstances.
|
|
- name: Stop and disable glance-registry when it is no longer used
|
|
shell: |
|
|
return_code=0
|
|
if [[ "$(systemctl is-active {{ glance_services['glance-registry']['service_name'] }})" == "active" ]]; then
|
|
systemctl stop {{ glance_services['glance-registry']['service_name'] }}
|
|
return_code=2
|
|
fi
|
|
if [[ "$(systemctl is-enabled {{ glance_services['glance-registry']['service_name'] }})" == "enabled" ]]; then
|
|
systemctl disable {{ glance_services['glance-registry']['service_name'] }}
|
|
return_code=2
|
|
fi
|
|
exit ${return_code}
|
|
args:
|
|
executable: /bin/bash
|
|
when:
|
|
- not glance_services['glance-registry']['condition']
|
|
register: _remove_glance_service
|
|
changed_when: _remove_glance_service.rc == 2
|
|
failed_when: _remove_glance_service.rc not in [0, 2]
|
|
listen:
|
|
- "Restart glance services"
|
|
- "venv changed"
|
|
# This task causes ansible-lint to give a ANSIBLE0014
|
|
# error, which does not make much sense given how the
|
|
# environment variable is used in this case.
|
|
# TODO(odyssey4me):
|
|
# Try to understand the issue ansible-lint is trying
|
|
# to highlight and address it.
|
|
tags:
|
|
- skip_ansible_lint
|
|
|
|
# TODO(odyssey4me):
|
|
# Assuming glance-registry is removed in the S cycle as planned, this
|
|
# task can be removed in the T cycle.
|
|
- name: Clean up glance-registry init files when they are no longer needed
|
|
file:
|
|
path: "{{ item }}"
|
|
state: absent
|
|
with_items:
|
|
- "/etc/tmpfiles.d/openstack-{{ glance_services['glance-registry']['service_name'] }}.conf"
|
|
- "/etc/systemd/system/{{ glance_services['glance-registry']['service_name'] }}.service"
|
|
when:
|
|
- not glance_services['glance-registry']['condition']
|
|
listen:
|
|
- "Restart glance services"
|
|
- "venv changed"
|
|
|
|
- name: Start services
|
|
service:
|
|
name: "{{ item.service_name }}"
|
|
enabled: yes
|
|
state: "started"
|
|
daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}"
|
|
with_items: "{{ filtered_glance_services }}"
|
|
register: _start
|
|
until: _start is success
|
|
retries: 5
|
|
delay: 2
|
|
listen:
|
|
- "Restart glance services"
|
|
- "venv changed"
|
|
|
|
- meta: noop
|
|
listen: Manage LB
|
|
when: false
|