From 8413941eaac3757cb0d0c625c6078debd353e732 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 14 Jul 2023 13:08:30 +0200 Subject: [PATCH] Fix linters and metadata With update of ansible-lint to version >=6.0.0 a lot of new linters were added, that enabled by default. In order to comply with linter rules we're applying changes to the role. With that we also update metdata to reflect current state. Depends-On: https://review.opendev.org/c/openstack/ansible-role-systemd_service/+/888223 Change-Id: I671cc35a055b35fb249ad3054c45ec65f2b54ab4 --- defaults/main.yml | 45 ++++++++++++++++++++---------- meta/main.yml | 12 ++++---- tasks/cinder_backends.yml | 28 +++++++++++++------ tasks/cinder_cleanup_old_facts.yml | 3 +- tasks/cinder_db_post_setup.yml | 2 ++ tasks/cinder_install.yml | 17 ++++++----- tasks/cinder_lvm_config.yml | 4 ++- tasks/cinder_post_install.yml | 4 ++- tasks/cinder_pre_install.yml | 6 ++-- tasks/cinder_qos.yml | 19 ++++++++----- tasks/main.yml | 45 ++++++++++++++++++++---------- vars/main.yml | 22 ++++++++++++--- 12 files changed, 139 insertions(+), 68 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index dec86063..16478fe5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -21,7 +21,11 @@ cinder_package_state: "{{ package_state | default('latest') }}" # for the service setup. The host must already have # clouds.yaml properly configured. cinder_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}" -cinder_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((cinder_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}" +cinder_service_setup_host_python_interpreter: >- + {{ + openstack_service_setup_host_python_interpreter | default( + (cinder_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) + }} # Set installation method. cinder_install_method: "{{ service_install_method | default('source') }}" @@ -29,7 +33,8 @@ cinder_venv_python_executable: "{{ openstack_venv_python_executable | default('p cinder_git_repo: https://opendev.org/openstack/cinder cinder_git_install_branch: master -cinder_upper_constraints_url: "{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}" +cinder_upper_constraints_url: >- + {{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }} cinder_git_constraints: - "--constraint {{ cinder_upper_constraints_url }}" @@ -64,7 +69,11 @@ cinder_fatal_deprecations: False ## Database info cinder_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}" -cinder_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((cinder_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}" +cinder_db_setup_python_interpreter: >- + {{ + openstack_db_setup_python_interpreter | default( + (cinder_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) + }} cinder_galera_address: "{{ galera_address | default('127.0.0.1') }}" cinder_galera_user: cinder cinder_galera_database: cinder @@ -230,7 +239,8 @@ cinder_swift_catalog_info: "object-store:swift:internalURL" ## Cap the maximun number of threads / workers when a user value is unspecified. cinder_osapi_volume_workers_max: 16 -cinder_osapi_volume_workers: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, cinder_osapi_volume_workers_max] | min }}" +cinder_osapi_volume_workers: >- + {{ [[(ansible_facts['processor_vcpus'] // ansible_facts['processor_threads_per_core']) | default(1), 1] | max * 2, cinder_osapi_volume_workers_max] | min }} ## Cinder iscsi cinder_target_helper_mapping: @@ -290,9 +300,9 @@ cinder_quota_backup_gigabytes: 1000 cinder_lvm_devices_filter_override: [] # cinder_backend_lvm_inuse: True if current host has an lvm backend -cinder_backend_lvm_inuse: '{{ (cinder_backends|default("")|to_json).find("lvm") != -1 }}' +cinder_backend_lvm_inuse: '{{ (cinder_backends | default("") | to_json).find("lvm") != -1 }}' # cinder_backend_rbd_inuse: True if the current host has an rbd backend -cinder_backend_rbd_inuse: '{{ (cinder_backends|default("")|to_json).find("cinder.volume.drivers.rbd.RBDDriver") != -1 }}' +cinder_backend_rbd_inuse: '{{ (cinder_backends | default("") | to_json).find("cinder.volume.drivers.rbd.RBDDriver") != -1 }}' # Set to false if you want to explicitly disable active/active cluster cinder_active_active_cluster: "{{ cinder_backend_rbd_inuse }}" @@ -301,12 +311,19 @@ cinder_active_active_cluster_name: ceph ## Policy vars # Provide a list of access controls to merge with the default # access controls in the service code. -#cinder_policy_overrides: -# "volume:create": "" -# "volume:delete": "" +# cinder_policy_overrides: +# "volume:create": "" +# "volume:delete": "" # Comma separated list of Glance API servers -cinder_glance_api_servers: "{{ (glance_service_internalurl | default('http://localhost')) | urlsplit('scheme') ~ '://' ~ (glance_service_internalurl | default('http://localhost')) | urlsplit('netloc') }}" +cinder_glance_api_servers: >- + {{ + ( + glance_service_internalurl | default('http://localhost') + ) | urlsplit('scheme') ~ '://' ~ ( + glance_service_internalurl | default('http://localhost') + ) | urlsplit('netloc') + }} cinder_service_in_ldap: "{{ service_ldap_backend_enabled | default(False) }}" @@ -373,7 +390,7 @@ cinder_services: # Cinder uWSGI settings cinder_wsgi_processes_max: 16 -cinder_wsgi_processes: "{{ [[ansible_facts['processor_vcpus']|default(1), 1] | max * 2, cinder_wsgi_processes_max] | min }}" +cinder_wsgi_processes: "{{ [[ansible_facts['processor_vcpus'] | default(1), 1] | max * 2, cinder_wsgi_processes_max] | min }}" cinder_wsgi_threads: 1 cinder_uwsgi_tls: crt: "{{ cinder_ssl_cert }}" @@ -408,8 +425,6 @@ cinder_environment_overrides: Service: Environment: "PATH={{ cinder_bin }}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" -_UUID_regex: "[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}" - cinder_memcached_servers: "{{ memcached_servers }}" ### @@ -457,8 +472,8 @@ cinder_pki_install_certificates: mode: "0600" # Define user-provided SSL certificates -#cinder_user_ssl_cert: -#cinder_user_ssl_key: +# cinder_user_ssl_cert: +# cinder_user_ssl_key: # Database cleanup # Periodically purge shadow tables, where archived records are stored diff --git a/meta/main.yml b/meta/main.yml index 88d8b85b..a50118da 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -18,19 +18,21 @@ galaxy_info: description: Installation and setup of cinder company: Rackspace license: Apache2 - min_ansible_version: 2.2 + role_name: os_cinder + namespace: openstack + min_ansible_version: "2.10" platforms: - name: Debian versions: - - buster + - bullseye - name: Ubuntu versions: - - bionic - focal + - jammy - name: EL versions: - - 8 - categories: + - "9" + galaxy_tags: - cloud - python - cinder diff --git a/tasks/cinder_backends.yml b/tasks/cinder_backends.yml index ec2f03a2..218a7e3f 100644 --- a/tasks/cinder_backends.yml +++ b/tasks/cinder_backends.yml @@ -39,32 +39,42 @@ - name: Add in cinder devices types shell: | . {{ ansible_facts['env']['HOME'] }}/openrc - CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure','') }}" - if ! {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ item.key }}"; then - {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type create --property volume_backend_name="{{ item.value.volume_backend_name }}" {% if not (item.value.public | default(True)) | bool %} --private {% endif %} "{{ item.key }}" + CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure', '') }}" + if ! {{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ item.key }}"; then + {{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume type create \ + --property volume_backend_name="{{ item.value.volume_backend_name }}" \ + {% if not (item.value.public | default(True)) | bool %} --private {% endif %} "{{ item.key }}" fi args: executable: /bin/bash - with_dict: "{{ _cinder_backends|default({}) }}" + vars: + __cinder_python_interpreter_dirname: "{{ cinder_service_setup_host_python_interpreter | dirname }}" + with_dict: "{{ _cinder_backends | default({}) }}" delegate_to: "{{ cinder_service_setup_host }}" changed_when: false - name: Add extra cinder volume types shell: | . {{ ansible_facts['env']['HOME'] }}/openrc - CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure','') }}" + CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure', '') }}" {% for evtype in item.value.extra_volume_types %} - if ! {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ evtype }}"; then - {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type create --property volume_backend_name="{{ item.value.volume_backend_name }}" {% if not (item.value.public | default(True)) | bool %} --private {% endif %} "{{ evtype }}" + if ! {{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ evtype }}"; then + {{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume type create \ + --property volume_backend_name="{{ item.value.volume_backend_name }}" \ + {% if not (item.value.public | default(True)) | bool %} --private {% endif %} "{{ evtype }}" fi {% endfor %} args: executable: /bin/bash - with_dict: "{{ _cinder_backends|default({}) }}" + vars: + __cinder_python_interpreter_dirname: "{{ cinder_service_setup_host_python_interpreter | dirname }}" + changed_when: false + with_dict: "{{ _cinder_backends | default({}) }}" delegate_to: "{{ cinder_service_setup_host }}" when: item.value.extra_volume_types is defined -- import_tasks: cinder_qos.yml +- name: Importing cinder_qos tasks + import_tasks: cinder_qos.yml when: cinder_qos_specs is defined tags: - cinder-qos diff --git a/tasks/cinder_cleanup_old_facts.yml b/tasks/cinder_cleanup_old_facts.yml index ea0fcf43..22862b54 100644 --- a/tasks/cinder_cleanup_old_facts.yml +++ b/tasks/cinder_cleanup_old_facts.yml @@ -22,8 +22,9 @@ section: cinder option: "need_db_sync" state: absent + mode: "0644" -- name: refresh local facts +- name: Refresh local facts setup: filter: ansible_local gather_subset: "!all" diff --git a/tasks/cinder_db_post_setup.yml b/tasks/cinder_db_post_setup.yml index e04fe62d..0795dbe3 100644 --- a/tasks/cinder_db_post_setup.yml +++ b/tasks/cinder_db_post_setup.yml @@ -29,6 +29,7 @@ - name: Check if all cinder services are up shell: "{{ cinder_bin }}/cinder-manage service list | /usr/bin/awk '{ if(NR>1) print $5 }' | /bin/egrep -vq ':-)'" register: failed_cinder_services + changed_when: false ignore_errors: True - name: Fail if any cinder service is down @@ -53,6 +54,7 @@ section: cinder option: need_online_data_migrations value: False + mode: "0644" with_items: "{{ groups[cinder_services['cinder-api']['group']] }}" when: - not data_migrations is skipped diff --git a/tasks/cinder_install.yml b/tasks/cinder_install.yml index 6886703e..db7d51b0 100644 --- a/tasks/cinder_install.yml +++ b/tasks/cinder_install.yml @@ -19,6 +19,7 @@ section: "cinder" option: "install_method" value: "{{ cinder_install_method }}" + mode: "0644" - name: Refresh local facts to ensure the cinder section is present setup: @@ -51,10 +52,10 @@ systemd_tempd_prefix: openstack systemd_slice_name: "{{ cinder_system_slice_name }}" systemd_lock_dir: "{{ cinder_lock_dir }}" - systemd_CPUAccounting: true - systemd_BlockIOAccounting: true - systemd_MemoryAccounting: true - systemd_TasksAccounting: true + systemd_service_cpu_accounting: true + systemd_service_block_io_accounting: true + systemd_service_memory_accounting: true + systemd_service_tasks_accounting: true systemd_services: "{{ filtered_cinder_services }}" tags: - cinder-config @@ -69,6 +70,7 @@ section: cinder option: venv_tag value: "{{ cinder_venv_tag }}" + mode: "0644" - name: Set the upgrade facts ini_file: @@ -76,10 +78,11 @@ section: cinder option: "{{ item }}" value: true + mode: "0644" with_items: - "need_online_data_migrations" - "need_service_restart" when: - (install_packages is changed) or - ('need_online_data_migrations' not in ansible_local['openstack_ansible']['cinder']) or - ('need_service_restart' not in ansible_local['openstack_ansible']['cinder']) + - (install_packages is changed) or + ('need_online_data_migrations' not in ansible_local['openstack_ansible']['cinder']) or + ('need_service_restart' not in ansible_local['openstack_ansible']['cinder']) diff --git a/tasks/cinder_lvm_config.yml b/tasks/cinder_lvm_config.yml index 60de1adf..07152d08 100644 --- a/tasks/cinder_lvm_config.yml +++ b/tasks/cinder_lvm_config.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Discover lvm devices - shell: | + shell: >- /sbin/pvdisplay | awk '/PV\ Name/ {print $3}' | sed 's/\/dev\///g' register: lvm_devices changed_when: lvm_devices.rc != 0 @@ -24,6 +24,7 @@ file: state: "directory" path: "/etc/lvm" + mode: "0755" when: lvm_devices.rc == 0 - name: Drop lvm Config @@ -33,4 +34,5 @@ owner: "root" group: "root" backup: "yes" + mode: "0644" when: lvm_devices.rc == 0 diff --git a/tasks/cinder_post_install.yml b/tasks/cinder_post_install.yml index a8b59bb8..61f4770b 100644 --- a/tasks/cinder_post_install.yml +++ b/tasks/cinder_post_install.yml @@ -21,6 +21,7 @@ state: "directory" owner: "root" group: "root" + mode: "0750" - name: Generate cinder config openstack.config_template.config_template: @@ -45,7 +46,7 @@ src: "{{ item.src }}" dest: "{{ item.dest }}" owner: "root" - group: "{{ item.group|default(cinder_system_group_name) }}" + group: "{{ item.group | default(cinder_system_group_name) }}" mode: "0640" config_overrides: "{{ item.config_overrides }}" config_type: "{{ item.config_type }}" @@ -160,6 +161,7 @@ template: src: nfs_shares.j2 dest: "{{ item.value.nfs_shares_config }}" + mode: "0644" with_dict: "{{ cinder_backends | default({}) }}" when: - "cinder_services['cinder-volume']['group'] in group_names" diff --git a/tasks/cinder_pre_install.yml b/tasks/cinder_pre_install.yml index 350e02e5..7979fef5 100644 --- a/tasks/cinder_pre_install.yml +++ b/tasks/cinder_pre_install.yml @@ -13,17 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: create the system group +- name: Create the system group group: name: "{{ cinder_system_group_name }}" - gid: "{{ cinder_system_group_gid|default(omit) }}" + gid: "{{ cinder_system_group_gid | default(omit) }}" state: "present" system: "yes" - name: Create the cinder system user user: name: "{{ cinder_system_user_name }}" - uid: "{{ cinder_system_user_uid|default(omit) }}" + uid: "{{ cinder_system_user_uid | default(omit) }}" group: "{{ cinder_system_group_name }}" comment: "{{ cinder_system_comment }}" shell: "{{ cinder_system_shell }}" diff --git a/tasks/cinder_qos.yml b/tasks/cinder_qos.yml index 859f5f2c..4bc12cbc 100644 --- a/tasks/cinder_qos.yml +++ b/tasks/cinder_qos.yml @@ -16,13 +16,15 @@ - name: Add in cinder qos types shell: | . {{ ansible_facts['env']['HOME'] }}/openrc - CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure','') }}" - {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume qos list --format value --column Name | grep -x {{ item.name }} || \ - {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume qos create {{ item.name }} \ + CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure', '') }}" + {{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume qos list --format value --column Name | grep -x {{ item.name }} || \ + {{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume qos create {{ item.name }} \ --consumer {{ item.options.consumer }}\ - {% for k,v in item.options.items() %} --property {{ k }}={{ v }}{% endfor %} + {% for k, v in item.options.items() %} --property {{ k }}={{ v }}{% endfor %} args: executable: /bin/bash + vars: + __cinder_python_interpreter_dirname: "{{ cinder_service_setup_host_python_interpreter | dirname }}" with_items: "{{ cinder_qos_specs }}" delegate_to: "{{ cinder_service_setup_host }}" changed_when: false @@ -32,15 +34,18 @@ - name: Associate qos types to volume types shell: | . {{ ansible_facts['env']['HOME'] }}/openrc - CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure','') }}" + CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure', '') }}" {% for vtype in item.cinder_volume_types %} - if {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ vtype }}"; then - {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume qos associate {{ item.name }} {{ vtype }} + if {{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ vtype }}"; then + {{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume qos associate {{ item.name }} {{ vtype }} fi {% endfor %} args: executable: /bin/bash + vars: + __cinder_python_interpreter_dirname: "{{ cinder_service_setup_host_python_interpreter | dirname }}" with_items: "{{ cinder_qos_specs }}" + changed_when: false delegate_to: "{{ cinder_service_setup_host }}" when: - item.cinder_volume_types is defined diff --git a/tasks/main.yml b/tasks/main.yml index 3b612489..46439d99 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -43,7 +43,8 @@ tags: - always -- include_role: +- name: Including osa.db_setup role + include_role: name: openstack.osa.db_setup apply: tags: @@ -64,7 +65,8 @@ tags: - always -- include_role: +- name: Including osa.mq_setup role + include_role: name: openstack.osa.mq_setup apply: tags: @@ -86,18 +88,21 @@ tags: - always -- import_tasks: cinder_lvm_config.yml +- name: Importing cinder_lvm_config tasks + import_tasks: cinder_lvm_config.yml when: - "cinder_services['cinder-volume']['group'] in group_names" - "cinder_backend_lvm_inuse | bool" tags: - cinder-config -- import_tasks: cinder_pre_install.yml +- name: Importing cinder_pre_install tasks + import_tasks: cinder_pre_install.yml tags: - cinder-install -- import_tasks: cinder_install.yml +- name: Importing cinder_install tasks + import_tasks: cinder_install.yml tags: - cinder-install @@ -121,14 +126,15 @@ tags: - always -- name: refresh local facts +- name: Refresh local facts setup: filter: ansible_local gather_subset: "!all" tags: - cinder-config -- include_tasks: cinder_cleanup_old_facts.yml +- name: Including cinder_cleanup_old_facts tasks + include_tasks: cinder_cleanup_old_facts.yml args: apply: tags: @@ -140,7 +146,8 @@ tags: - always -- import_tasks: cinder_post_install.yml +- name: Importing cinder_post_install tasks + import_tasks: cinder_post_install.yml tags: - cinder-config @@ -155,17 +162,22 @@ systemd_services: - service_name: "cinder-volume-usage-audit" execstarts: - - '/bin/bash -c "{{ cinder_bin }}/cinder-volume-usage-audit --start_time \"$$(date\s+%%Y-%%m-%%d\\\s%%H:00:00\s-d\s-1{{ cinder_volume_usage_audit }})\" --end_time \"$$(date\s+%%Y-%%m-%%d\\\s%%H:00:00)\" {{ (cinder_volume_usage_audit_send_actions_enabled | bool) | ternary( "--send_actions", "--nosend_actions" ) }}"' + - >- + /bin/bash -c "{{ cinder_bin }}/cinder-volume-usage-audit --start_time \"$$(date\s+%%Y-%%m-%%d\\\s%%H:00:00\s-d\s-1{{ cinder_volume_usage_audit }})\" + --end_time \"$$(date\s+%%Y-%%m-%%d\\\s%%H:00:00)\" {{ + (cinder_volume_usage_audit_send_actions_enabled | bool) | ternary('--send_actions', '--nosend_actions') + }}" timer: state: "{{ ((cinder_services['cinder-volume']['group'] in group_names) and (cinder_ceilometer_enabled | bool)) | ternary('started', 'stopped') }}" options: OnBootSec: 30min - OnCalendar: "{{ (cinder_volume_usage_audit == 'day') | ternary('daily', cinder_volume_usage_audit+'ly') }}" + OnCalendar: "{{ (cinder_volume_usage_audit == 'day') | ternary('daily', cinder_volume_usage_audit + 'ly') }}" Persistent: true tags: - cinder-config -- import_tasks: cinder_db_sync.yml +- name: Importing cinder_db_sync tasks + import_tasks: cinder_db_sync.yml when: - _cinder_is_first_api_play_host tags: @@ -181,7 +193,8 @@ - cinder-config - uwsgi -- include_role: +- name: Including osa.service_setup role + include_role: name: openstack.osa.service_setup apply: tags: @@ -231,18 +244,20 @@ retries: 5 delay: 2 when: - - "cinder_services['cinder-volume']['group'] in group_names" + - "cinder_services['cinder-volume']['group'] in group_names" - name: Flush handlers meta: flush_handlers -- import_tasks: cinder_db_post_setup.yml +- name: Importing cinder_db_post_setup tasks + import_tasks: cinder_db_post_setup.yml when: - "_cinder_is_last_play_host" tags: - cinder-config -- import_tasks: cinder_backends.yml +- name: Importing cinder_backends tasks + import_tasks: cinder_backends.yml when: - "groups[cinder_services['cinder-volume']['group']] | length > 0" - "_cinder_is_last_play_host" diff --git a/vars/main.yml b/vars/main.yml index ee9c883d..1815c27e 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -13,9 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -_cinder_is_first_api_play_host: "{{ (cinder_services['cinder-api']['group'] in group_names and inventory_hostname == (groups[cinder_services['cinder-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }}" -_cinder_is_first_play_host: "{{ (cinder_services['cinder-scheduler']['group'] in group_names and inventory_hostname == (groups[cinder_services['cinder-scheduler']['group']] | intersect(ansible_play_hosts)) | first) | bool }}" -_cinder_is_last_play_host: "{{ (cinder_services['cinder-api']['group'] in group_names and inventory_hostname == (groups[cinder_services['cinder-api']['group']] | intersect(ansible_play_hosts)) | last) | bool }}" +_cinder_is_first_api_play_host: >- + {{ + (cinder_services['cinder-api']['group'] in group_names and + inventory_hostname == (groups[cinder_services['cinder-api']['group']] | intersect(ansible_play_hosts)) | first) | bool + }} +_cinder_is_first_play_host: >- + {{ + (cinder_services['cinder-scheduler']['group'] in group_names and + inventory_hostname == (groups[cinder_services['cinder-scheduler']['group']] | intersect(ansible_play_hosts)) | first) | bool + }} +_cinder_is_last_play_host: >- + {{ + (cinder_services['cinder-api']['group'] in group_names and + inventory_hostname == (groups[cinder_services['cinder-api']['group']] | intersect(ansible_play_hosts)) | last) | bool + }} _cinder_rootwrap_conf_overrides: DEFAULT: @@ -136,4 +148,6 @@ _cinder_coordination_url: >- groups[cinder_coordination_group] | map('extract', hostvars, 'ansible_host') | list | join(':' ~ cinder_coordination_port ~ ',') - }}:{{ cinder_coordination_port }}?namespace={{ cinder_coordination_namespace }}{% if cinder_coordination_client_ssl | bool %}&use_ssl=True&verify_certs={{ cinder_coordination_verify_cert | bool }}{% endif %} + }}:{{ cinder_coordination_port -}} + ?namespace={{ cinder_coordination_namespace }}{% if cinder_coordination_client_ssl | bool -%} + &use_ssl=True&verify_certs={{ cinder_coordination_verify_cert | bool }}{% endif %}