diff --git a/ansible/roles/cinder/templates/cinder.conf.j2 b/ansible/roles/cinder/templates/cinder.conf.j2
index 224677fd5c..cccbb0ca41 100644
--- a/ansible/roles/cinder/templates/cinder.conf.j2
+++ b/ansible/roles/cinder/templates/cinder.conf.j2
@@ -21,7 +21,8 @@ os_region_name = {{ openstack_region_name }}
 enabled_backends = {{ cinder_enabled_backends|map(attribute='name')|join(',') }}
 {% endif %}
 
-{% if service_name == "cinder-backup" and enable_ceph | bool and cinder_backend_ceph | bool %}
+{% if service_name == "cinder-backup" %}
+{% if enable_ceph | bool and cinder_backup_driver == "ceph" %}
 backup_driver = cinder.backup.drivers.ceph
 backup_ceph_conf = /etc/ceph/ceph.conf
 backup_ceph_user = cinder-backup
@@ -30,13 +31,13 @@ backup_ceph_pool = {{ ceph_cinder_backup_pool_name }}
 backup_ceph_stripe_unit = 0
 backup_ceph_stripe_count = 0
 restore_discard_excess_bytes = true
-{% elif cinder_backup_driver == "nfs"%}
+{% elif cinder_backup_driver == "nfs" %}
 backup_driver = cinder.backup.drivers.nfs
 backup_mount_options = {{ cinder_backup_mount_options_nfs }}
 backup_mount_point_base = /var/lib/cinder/backup
 backup_share = {{ cinder_backup_share }}
 backup_file_size = 327680000
-{% elif cinder_backup_driver == "swift"%}
+{% elif enable_swift | bool and cinder_backup_driver == "swift" %}
 backup_driver = cinder.backup.drivers.swift
 backup_swift_url = http://{{ kolla_internal_vip_address }}:{{ swift_proxy_server_port }}/v1/AUTH_
 backup_swift_auth = per_user
@@ -44,6 +45,7 @@ backup_swift_auth_version = 1
 backup_swift_user =
 backup_swift_key =
 {% endif %}
+{% endif %}
 
 osapi_volume_listen = {{ api_interface_address }}
 osapi_volume_listen_port = {{ cinder_api_port }}