openstack-ansible-os_cinder/tasks/cinder_init_common.yml
Jimmy McCrory c84f90a298 Use dictionary for service group mappings
Change the 'cinder_service_names' from a list to a dictionary mapping of
services, groups that install those services, and any additional
conditions around their installations. The init tasks have been updated
to run once and loop through this mapping rather than being
included multiple times and re-run against each host. This may
potentially reduce role run times.

Common variables shared by each service's template files have also been
updated to use the service namespaced variables.

Change-Id: Ifeb890cc733921a6f882e4d9cdb778e22c82e9c5
2016-09-26 16:29:37 -07:00

35 lines
1.0 KiB
YAML

---
# Copyright 2016, Rackspace US, Inc.
# Copyright 2016, IBM 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.
- include: cinder_init_upstart.yml
static: no
when: pid1_name == "init"
- include: cinder_init_systemd.yml
static: no
when: pid1_name == "systemd"
- name: Load service
service:
name: "{{ item.key }}"
enabled: "yes"
with_dict: "{{ cinder_service_names }}"
when:
- inventory_hostname in groups[item.value.group]
- "{{ item.value.condition | default(true) }}"
notify:
- Restart cinder services