Automatically set swift as the glance default store

This patch implements an automated determination of whether glance
should have the default store set to swift based on whether there
are swift hosts in the environment.

This reduces the number of variables a deployer needs to set in
order to have a functional environment.

Change-Id: I6909ba2555ab13da5a49a25fb8462ae6a71552af
This commit is contained in:
Jesse Pretorius 2016-08-20 13:41:26 +01:00 committed by Jesse Pretorius (odyssey4me)
parent 5dcfd6ac50
commit 64c6307e29
5 changed files with 23 additions and 4 deletions

View File

@ -22,11 +22,14 @@
debug: false
## Common Glance Overrides
# Set glance_default_store to "swift" if using Cloud Files or swift backend
# Set glance_default_store to "swift" if using Cloud Files backend
# or "rbd" if using ceph backend; the latter will trigger ceph to get
# installed on glance. If using a file store, a shared file store is
# recommended. See the OpenStack-Ansible install guide and the OpenStack
# documentation for more details.
# Note that "swift" is automatically set as the default back-end if there
# are any swift hosts in the environment. Use this setting to override
# this automation if you wish for a different default back-end.
# glance_default_store: file
## Ceph pool name for Glance to use

View File

@ -13,6 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# If there are Swift hosts in the environment, then use it as the default Glance store
# This is specifically duplicated from glance_all for the cinder_glance_api_version
# setting below.
glance_default_store: "{{ ((groups['swift_all'] is defined) and (groups['swift_all'] | length > 0)) | ternary('swift', 'file') }}"
# cinder_backend_lvm_inuse: True if current host has an lvm backend
cinder_backend_lvm_inuse: '{{ (cinder_backends|default("")|to_json).find("cinder.volume.drivers.lvm.LVMVolumeDriver") != -1 }}'
cinder_service_region: "{{ service_region }}"

View File

@ -19,5 +19,8 @@ glance_service_in_ldap: "{{ service_ldap_backend_enabled }}"
# If there are any Ceilometer hosts in the environment, then enable its usage
glance_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (groups['ceilometer_all'] | length > 0) }}"
# If there are Swift hosts in the environment, then use it as the default Glance store
glance_default_store: "{{ ((groups['swift_all'] is defined) and (groups['swift_all'] | length > 0)) | ternary('swift', 'file') }}"
# Ensure that the package state matches the global setting
glance_package_state: "{{ package_state }}"

View File

@ -0,0 +1,11 @@
---
features:
- If there are swift hosts in the environment, then the value for
``glance_default_store`` will automatically be set to ``swift``.
This negates the need to set this variable in ``user_variables.yml``,
but the value may still be overridden at the deployer discretion.
upgrade:
- If there are swift hosts in the environment, then the value for
``glance_default_store`` will automatically be set to ``swift``.
This negates the need to set this variable in ``user_variables.yml``,
but the value may still be overridden at the deployer discretion.

View File

@ -16,9 +16,6 @@
## General options
debug: True
## Glance Options
glance_default_store: swift
## Cinder settings
cinder_service_backup_program_enabled: True