diff --git a/etc/openstack_deploy/user_variables.yml b/etc/openstack_deploy/user_variables.yml index 6795014e07..fb7727496f 100644 --- a/etc/openstack_deploy/user_variables.yml +++ b/etc/openstack_deploy/user_variables.yml @@ -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 diff --git a/playbooks/inventory/group_vars/cinder_all.yml b/playbooks/inventory/group_vars/cinder_all.yml index 4a30889852..57ceb0966f 100644 --- a/playbooks/inventory/group_vars/cinder_all.yml +++ b/playbooks/inventory/group_vars/cinder_all.yml @@ -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 }}" diff --git a/playbooks/inventory/group_vars/glance_all.yml b/playbooks/inventory/group_vars/glance_all.yml index ba2398569d..3de9f9cf4d 100644 --- a/playbooks/inventory/group_vars/glance_all.yml +++ b/playbooks/inventory/group_vars/glance_all.yml @@ -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 }}" diff --git a/releasenotes/notes/detect-glance-default-store-swift-b9c36f4a2fe05ec4.yaml b/releasenotes/notes/detect-glance-default-store-swift-b9c36f4a2fe05ec4.yaml new file mode 100644 index 0000000000..073eea0752 --- /dev/null +++ b/releasenotes/notes/detect-glance-default-store-swift-b9c36f4a2fe05ec4.yaml @@ -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. diff --git a/tests/roles/bootstrap-host/templates/user_variables.aio.yml.j2 b/tests/roles/bootstrap-host/templates/user_variables.aio.yml.j2 index ee8a5a5733..cfeb3b04f7 100644 --- a/tests/roles/bootstrap-host/templates/user_variables.aio.yml.j2 +++ b/tests/roles/bootstrap-host/templates/user_variables.aio.yml.j2 @@ -16,9 +16,6 @@ ## General options debug: True -## Glance Options -glance_default_store: swift - ## Cinder settings cinder_service_backup_program_enabled: True