Set manila_backends to empty dict by default
This simplifies logic across the role and not verify if variable is defined each time we're attempting to use it. Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/787341 Change-Id: I6db4ad6e6389b1ff63dc52a1e48c477a97905d17
This commit is contained in:
parent
91b53f2b6c
commit
286414c2a6
@ -191,6 +191,7 @@ manila_quota_share_networks: 10
|
|||||||
# driver_handles_share_servers: False
|
# driver_handles_share_servers: False
|
||||||
# lvm_share_volume_group: manila_shares
|
# lvm_share_volume_group: manila_shares
|
||||||
# lvm_share_export_ips: <server-ip>
|
# lvm_share_export_ips: <server-ip>
|
||||||
|
manila_backends: {}
|
||||||
|
|
||||||
manila_enabled_share_protocols:
|
manila_enabled_share_protocols:
|
||||||
- NFS
|
- NFS
|
||||||
@ -201,9 +202,9 @@ manila_default_share_type: "{{ _manila_default_share_type | default('') }}"
|
|||||||
manila_share_name_template: share-%s
|
manila_share_name_template: share-%s
|
||||||
|
|
||||||
# manila_backend_lvm_inuse: True if current host has an lvm backend
|
# manila_backend_lvm_inuse: True if current host has an lvm backend
|
||||||
manila_backend_lvm_inuse: "{{ (manila_backends | default('') | to_json).find('lvm') != -1 }}"
|
manila_backend_lvm_inuse: "{{ (manila_backends | to_json).find('lvm') != -1 }}"
|
||||||
# manila_backend_rbd_inuse: True if the current host has an rbd backend
|
# manila_backend_rbd_inuse: True if the current host has an rbd backend
|
||||||
manila_backend_rbd_inuse: "{{ (manila_backends | default('')|to_json).find('manila.share.drivers.cephfs') != -1 }}"
|
manila_backend_rbd_inuse: "{{ (manila_backends |to_json).find('manila.share.drivers.cephfs') != -1 }}"
|
||||||
|
|
||||||
## Policy vars
|
## Policy vars
|
||||||
# Provide a list of access controls to update the default policy.json with. These changes will be merged
|
# Provide a list of access controls to update the default policy.json with. These changes will be merged
|
||||||
|
@ -182,7 +182,7 @@
|
|||||||
|
|
||||||
- name: Create singular manila_backends variable for all hosts
|
- name: Create singular manila_backends variable for all hosts
|
||||||
set_fact:
|
set_fact:
|
||||||
_manila_backends: "{{ (_manila_backends | default(manila_backends | default({}))) | combine(hostvars[item]['manila_backends'] | default({})) }}"
|
_manila_backends: "{{ (_manila_backends | default(manila_backends)) | combine(hostvars[item]['manila_backends'] | default({})) }}"
|
||||||
with_items: "{{ groups[manila_services['manila-share']['group']] }}"
|
with_items: "{{ groups[manila_services['manila-share']['group']] }}"
|
||||||
tags:
|
tags:
|
||||||
- manila-config
|
- manila-config
|
||||||
|
@ -35,18 +35,16 @@ storage_availability_zone = {{ manila_storage_availability_zone }}
|
|||||||
enabled_share_protocols={{ manila_enabled_share_protocols | join(',') }}
|
enabled_share_protocols={{ manila_enabled_share_protocols | join(',') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if manila_backends is defined %}
|
|
||||||
enabled_share_backends={% for backend in manila_backends | dictsort %}{{ backend.0 }}{% if not loop.last %},{% endif %}{% endfor %}
|
enabled_share_backends={% for backend in manila_backends | dictsort %}{{ backend.0 }}{% if not loop.last %},{% endif %}{% endfor %}
|
||||||
|
|
||||||
# All given backend(s)
|
# All given backend(s)
|
||||||
{% for backend_section in manila_backends | dictsort %}
|
{% for backend_section in manila_backends | dictsort %}
|
||||||
[{{ backend_section.0 }}]
|
[{{ backend_section.0 }}]
|
||||||
{% for key, value in (backend_section.1 | dictsort) if key not in ['extra_share_types', 'shares'] %}
|
{% for key, value in (backend_section.1 | dictsort) if key not in ['extra_share_types', 'shares'] %}
|
||||||
{{ key }}={{ value }}
|
{{ key }}={{ value }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
connection = mysql+pymysql://{{ manila_galera_user }}:{{ manila_container_mysql_password }}@{{ manila_galera_address }}/{{ manila_galera_database }}?charset=utf8{% if manila_galera_use_ssl | bool %}&ssl_ca={{ manila_galera_ssl_ca_cert }}{% endif %}
|
connection = mysql+pymysql://{{ manila_galera_user }}:{{ manila_container_mysql_password }}@{{ manila_galera_address }}/{{ manila_galera_database }}?charset=utf8{% if manila_galera_use_ssl | bool %}&ssl_ca={{ manila_galera_ssl_ca_cert }}{% endif %}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
_manila_is_first_play_host: "{{ (manila_services['manila-api']['group'] in group_names and inventory_hostname == (groups[manila_services['manila-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }}"
|
_manila_is_first_play_host: "{{ (manila_services['manila-api']['group'] in group_names and inventory_hostname == (groups[manila_services['manila-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }}"
|
||||||
_manila_share_is_first_play_host: "{{ (manila_services['manila-share']['group'] in group_names and inventory_hostname == (groups[manila_services['manila-share']['group']] | intersect(ansible_play_hosts)) | first) | bool }}"
|
_manila_share_is_first_play_host: "{{ (manila_services['manila-share']['group'] in group_names and inventory_hostname == (groups[manila_services['manila-share']['group']] | intersect(ansible_play_hosts)) | first) | bool }}"
|
||||||
|
|
||||||
_manila_default_share_type_list: "{{ (manila_backends | default({})).keys() | list }}"
|
_manila_default_share_type_list: "{{ manila_backends.keys() | list }}"
|
||||||
_manila_default_share_type: "{{ ((_manila_default_share_type_list | length) > 0) | ternary(_manila_default_share_type_list[0], '') }}"
|
_manila_default_share_type: "{{ ((_manila_default_share_type_list | length) > 0) | ternary(_manila_default_share_type_list[0], '') }}"
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user