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
This commit is contained in:
Dmitriy Rabotyagov 2023-07-14 13:08:30 +02:00 committed by Dmitriy Rabotyagov
parent 2820fcc1d6
commit 8413941eaa
12 changed files with 139 additions and 68 deletions

View File

@ -21,7 +21,11 @@ cinder_package_state: "{{ package_state | default('latest') }}"
# for the service setup. The host must already have # for the service setup. The host must already have
# clouds.yaml properly configured. # clouds.yaml properly configured.
cinder_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}" 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. # Set installation method.
cinder_install_method: "{{ service_install_method | default('source') }}" 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_repo: https://opendev.org/openstack/cinder
cinder_git_install_branch: master 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: cinder_git_constraints:
- "--constraint {{ cinder_upper_constraints_url }}" - "--constraint {{ cinder_upper_constraints_url }}"
@ -64,7 +69,11 @@ cinder_fatal_deprecations: False
## Database info ## Database info
cinder_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}" 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_address: "{{ galera_address | default('127.0.0.1') }}"
cinder_galera_user: cinder cinder_galera_user: cinder
cinder_galera_database: 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. ## Cap the maximun number of threads / workers when a user value is unspecified.
cinder_osapi_volume_workers_max: 16 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 iscsi
cinder_target_helper_mapping: cinder_target_helper_mapping:
@ -290,9 +300,9 @@ cinder_quota_backup_gigabytes: 1000
cinder_lvm_devices_filter_override: [] cinder_lvm_devices_filter_override: []
# cinder_backend_lvm_inuse: True if current host has an lvm backend # 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: 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 # Set to false if you want to explicitly disable active/active cluster
cinder_active_active_cluster: "{{ cinder_backend_rbd_inuse }}" cinder_active_active_cluster: "{{ cinder_backend_rbd_inuse }}"
@ -301,12 +311,19 @@ cinder_active_active_cluster_name: ceph
## Policy vars ## Policy vars
# Provide a list of access controls to merge with the default # Provide a list of access controls to merge with the default
# access controls in the service code. # access controls in the service code.
#cinder_policy_overrides: # cinder_policy_overrides:
# "volume:create": "" # "volume:create": ""
# "volume:delete": "" # "volume:delete": ""
# Comma separated list of Glance API servers # 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) }}" cinder_service_in_ldap: "{{ service_ldap_backend_enabled | default(False) }}"
@ -373,7 +390,7 @@ cinder_services:
# Cinder uWSGI settings # Cinder uWSGI settings
cinder_wsgi_processes_max: 16 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_wsgi_threads: 1
cinder_uwsgi_tls: cinder_uwsgi_tls:
crt: "{{ cinder_ssl_cert }}" crt: "{{ cinder_ssl_cert }}"
@ -408,8 +425,6 @@ cinder_environment_overrides:
Service: Service:
Environment: "PATH={{ cinder_bin }}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 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 }}" cinder_memcached_servers: "{{ memcached_servers }}"
### ###
@ -457,8 +472,8 @@ cinder_pki_install_certificates:
mode: "0600" mode: "0600"
# Define user-provided SSL certificates # Define user-provided SSL certificates
#cinder_user_ssl_cert: <path to cert on ansible deployment host> # cinder_user_ssl_cert: <path to cert on ansible deployment host>
#cinder_user_ssl_key: <path to cert on ansible deployment host> # cinder_user_ssl_key: <path to cert on ansible deployment host>
# Database cleanup # Database cleanup
# Periodically purge shadow tables, where archived records are stored # Periodically purge shadow tables, where archived records are stored

View File

@ -18,19 +18,21 @@ galaxy_info:
description: Installation and setup of cinder description: Installation and setup of cinder
company: Rackspace company: Rackspace
license: Apache2 license: Apache2
min_ansible_version: 2.2 role_name: os_cinder
namespace: openstack
min_ansible_version: "2.10"
platforms: platforms:
- name: Debian - name: Debian
versions: versions:
- buster - bullseye
- name: Ubuntu - name: Ubuntu
versions: versions:
- bionic
- focal - focal
- jammy
- name: EL - name: EL
versions: versions:
- 8 - "9"
categories: galaxy_tags:
- cloud - cloud
- python - python
- cinder - cinder

View File

@ -39,32 +39,42 @@
- name: Add in cinder devices types - name: Add in cinder devices types
shell: | shell: |
. {{ ansible_facts['env']['HOME'] }}/openrc . {{ 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', '') }}"
if ! {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ item.key }}"; then if ! {{ __cinder_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 }}" {{ __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 fi
args: args:
executable: /bin/bash 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 }}" delegate_to: "{{ cinder_service_setup_host }}"
changed_when: false changed_when: false
- name: Add extra cinder volume types - name: Add extra cinder volume types
shell: | shell: |
. {{ ansible_facts['env']['HOME'] }}/openrc . {{ 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 %} {% for evtype in item.value.extra_volume_types %}
if ! {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ evtype }}"; then if ! {{ __cinder_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 }}" {{ __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 fi
{% endfor %} {% endfor %}
args: args:
executable: /bin/bash 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 }}" delegate_to: "{{ cinder_service_setup_host }}"
when: item.value.extra_volume_types is defined 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 when: cinder_qos_specs is defined
tags: tags:
- cinder-qos - cinder-qos

View File

@ -22,8 +22,9 @@
section: cinder section: cinder
option: "need_db_sync" option: "need_db_sync"
state: absent state: absent
mode: "0644"
- name: refresh local facts - name: Refresh local facts
setup: setup:
filter: ansible_local filter: ansible_local
gather_subset: "!all" gather_subset: "!all"

View File

@ -29,6 +29,7 @@
- name: Check if all cinder services are up - 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 ':-)'" shell: "{{ cinder_bin }}/cinder-manage service list | /usr/bin/awk '{ if(NR>1) print $5 }' | /bin/egrep -vq ':-)'"
register: failed_cinder_services register: failed_cinder_services
changed_when: false
ignore_errors: True ignore_errors: True
- name: Fail if any cinder service is down - name: Fail if any cinder service is down
@ -53,6 +54,7 @@
section: cinder section: cinder
option: need_online_data_migrations option: need_online_data_migrations
value: False value: False
mode: "0644"
with_items: "{{ groups[cinder_services['cinder-api']['group']] }}" with_items: "{{ groups[cinder_services['cinder-api']['group']] }}"
when: when:
- not data_migrations is skipped - not data_migrations is skipped

View File

@ -19,6 +19,7 @@
section: "cinder" section: "cinder"
option: "install_method" option: "install_method"
value: "{{ cinder_install_method }}" value: "{{ cinder_install_method }}"
mode: "0644"
- name: Refresh local facts to ensure the cinder section is present - name: Refresh local facts to ensure the cinder section is present
setup: setup:
@ -51,10 +52,10 @@
systemd_tempd_prefix: openstack systemd_tempd_prefix: openstack
systemd_slice_name: "{{ cinder_system_slice_name }}" systemd_slice_name: "{{ cinder_system_slice_name }}"
systemd_lock_dir: "{{ cinder_lock_dir }}" systemd_lock_dir: "{{ cinder_lock_dir }}"
systemd_CPUAccounting: true systemd_service_cpu_accounting: true
systemd_BlockIOAccounting: true systemd_service_block_io_accounting: true
systemd_MemoryAccounting: true systemd_service_memory_accounting: true
systemd_TasksAccounting: true systemd_service_tasks_accounting: true
systemd_services: "{{ filtered_cinder_services }}" systemd_services: "{{ filtered_cinder_services }}"
tags: tags:
- cinder-config - cinder-config
@ -69,6 +70,7 @@
section: cinder section: cinder
option: venv_tag option: venv_tag
value: "{{ cinder_venv_tag }}" value: "{{ cinder_venv_tag }}"
mode: "0644"
- name: Set the upgrade facts - name: Set the upgrade facts
ini_file: ini_file:
@ -76,10 +78,11 @@
section: cinder section: cinder
option: "{{ item }}" option: "{{ item }}"
value: true value: true
mode: "0644"
with_items: with_items:
- "need_online_data_migrations" - "need_online_data_migrations"
- "need_service_restart" - "need_service_restart"
when: when:
(install_packages is changed) or - (install_packages is changed) or
('need_online_data_migrations' not in ansible_local['openstack_ansible']['cinder']) or ('need_online_data_migrations' not in ansible_local['openstack_ansible']['cinder']) or
('need_service_restart' not in ansible_local['openstack_ansible']['cinder']) ('need_service_restart' not in ansible_local['openstack_ansible']['cinder'])

View File

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Discover lvm devices - name: Discover lvm devices
shell: | shell: >-
/sbin/pvdisplay | awk '/PV\ Name/ {print $3}' | sed 's/\/dev\///g' /sbin/pvdisplay | awk '/PV\ Name/ {print $3}' | sed 's/\/dev\///g'
register: lvm_devices register: lvm_devices
changed_when: lvm_devices.rc != 0 changed_when: lvm_devices.rc != 0
@ -24,6 +24,7 @@
file: file:
state: "directory" state: "directory"
path: "/etc/lvm" path: "/etc/lvm"
mode: "0755"
when: lvm_devices.rc == 0 when: lvm_devices.rc == 0
- name: Drop lvm Config - name: Drop lvm Config
@ -33,4 +34,5 @@
owner: "root" owner: "root"
group: "root" group: "root"
backup: "yes" backup: "yes"
mode: "0644"
when: lvm_devices.rc == 0 when: lvm_devices.rc == 0

View File

@ -21,6 +21,7 @@
state: "directory" state: "directory"
owner: "root" owner: "root"
group: "root" group: "root"
mode: "0750"
- name: Generate cinder config - name: Generate cinder config
openstack.config_template.config_template: openstack.config_template.config_template:
@ -45,7 +46,7 @@
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
owner: "root" owner: "root"
group: "{{ item.group|default(cinder_system_group_name) }}" group: "{{ item.group | default(cinder_system_group_name) }}"
mode: "0640" mode: "0640"
config_overrides: "{{ item.config_overrides }}" config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}" config_type: "{{ item.config_type }}"
@ -160,6 +161,7 @@
template: template:
src: nfs_shares.j2 src: nfs_shares.j2
dest: "{{ item.value.nfs_shares_config }}" dest: "{{ item.value.nfs_shares_config }}"
mode: "0644"
with_dict: "{{ cinder_backends | default({}) }}" with_dict: "{{ cinder_backends | default({}) }}"
when: when:
- "cinder_services['cinder-volume']['group'] in group_names" - "cinder_services['cinder-volume']['group'] in group_names"

View File

@ -13,17 +13,17 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: create the system group - name: Create the system group
group: group:
name: "{{ cinder_system_group_name }}" name: "{{ cinder_system_group_name }}"
gid: "{{ cinder_system_group_gid|default(omit) }}" gid: "{{ cinder_system_group_gid | default(omit) }}"
state: "present" state: "present"
system: "yes" system: "yes"
- name: Create the cinder system user - name: Create the cinder system user
user: user:
name: "{{ cinder_system_user_name }}" name: "{{ cinder_system_user_name }}"
uid: "{{ cinder_system_user_uid|default(omit) }}" uid: "{{ cinder_system_user_uid | default(omit) }}"
group: "{{ cinder_system_group_name }}" group: "{{ cinder_system_group_name }}"
comment: "{{ cinder_system_comment }}" comment: "{{ cinder_system_comment }}"
shell: "{{ cinder_system_shell }}" shell: "{{ cinder_system_shell }}"

View File

@ -16,13 +16,15 @@
- name: Add in cinder qos types - name: Add in cinder qos types
shell: | shell: |
. {{ ansible_facts['env']['HOME'] }}/openrc . {{ 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', '') }}"
{{ cinder_service_setup_host_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 list --format value --column Name | grep -x {{ item.name }} || \
{{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume qos create {{ item.name }} \ {{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume qos create {{ item.name }} \
--consumer {{ item.options.consumer }}\ --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: args:
executable: /bin/bash executable: /bin/bash
vars:
__cinder_python_interpreter_dirname: "{{ cinder_service_setup_host_python_interpreter | dirname }}"
with_items: "{{ cinder_qos_specs }}" with_items: "{{ cinder_qos_specs }}"
delegate_to: "{{ cinder_service_setup_host }}" delegate_to: "{{ cinder_service_setup_host }}"
changed_when: false changed_when: false
@ -32,15 +34,18 @@
- name: Associate qos types to volume types - name: Associate qos types to volume types
shell: | shell: |
. {{ ansible_facts['env']['HOME'] }}/openrc . {{ 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 %} {% for vtype in item.cinder_volume_types %}
if {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ vtype }}"; then if {{ __cinder_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 }} {{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume qos associate {{ item.name }} {{ vtype }}
fi fi
{% endfor %} {% endfor %}
args: args:
executable: /bin/bash executable: /bin/bash
vars:
__cinder_python_interpreter_dirname: "{{ cinder_service_setup_host_python_interpreter | dirname }}"
with_items: "{{ cinder_qos_specs }}" with_items: "{{ cinder_qos_specs }}"
changed_when: false
delegate_to: "{{ cinder_service_setup_host }}" delegate_to: "{{ cinder_service_setup_host }}"
when: when:
- item.cinder_volume_types is defined - item.cinder_volume_types is defined

View File

@ -43,7 +43,8 @@
tags: tags:
- always - always
- include_role: - name: Including osa.db_setup role
include_role:
name: openstack.osa.db_setup name: openstack.osa.db_setup
apply: apply:
tags: tags:
@ -64,7 +65,8 @@
tags: tags:
- always - always
- include_role: - name: Including osa.mq_setup role
include_role:
name: openstack.osa.mq_setup name: openstack.osa.mq_setup
apply: apply:
tags: tags:
@ -86,18 +88,21 @@
tags: tags:
- always - always
- import_tasks: cinder_lvm_config.yml - name: Importing cinder_lvm_config tasks
import_tasks: cinder_lvm_config.yml
when: when:
- "cinder_services['cinder-volume']['group'] in group_names" - "cinder_services['cinder-volume']['group'] in group_names"
- "cinder_backend_lvm_inuse | bool" - "cinder_backend_lvm_inuse | bool"
tags: tags:
- cinder-config - cinder-config
- import_tasks: cinder_pre_install.yml - name: Importing cinder_pre_install tasks
import_tasks: cinder_pre_install.yml
tags: tags:
- cinder-install - cinder-install
- import_tasks: cinder_install.yml - name: Importing cinder_install tasks
import_tasks: cinder_install.yml
tags: tags:
- cinder-install - cinder-install
@ -121,14 +126,15 @@
tags: tags:
- always - always
- name: refresh local facts - name: Refresh local facts
setup: setup:
filter: ansible_local filter: ansible_local
gather_subset: "!all" gather_subset: "!all"
tags: tags:
- cinder-config - cinder-config
- include_tasks: cinder_cleanup_old_facts.yml - name: Including cinder_cleanup_old_facts tasks
include_tasks: cinder_cleanup_old_facts.yml
args: args:
apply: apply:
tags: tags:
@ -140,7 +146,8 @@
tags: tags:
- always - always
- import_tasks: cinder_post_install.yml - name: Importing cinder_post_install tasks
import_tasks: cinder_post_install.yml
tags: tags:
- cinder-config - cinder-config
@ -155,17 +162,22 @@
systemd_services: systemd_services:
- service_name: "cinder-volume-usage-audit" - service_name: "cinder-volume-usage-audit"
execstarts: 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: timer:
state: "{{ ((cinder_services['cinder-volume']['group'] in group_names) and (cinder_ceilometer_enabled | bool)) | ternary('started', 'stopped') }}" state: "{{ ((cinder_services['cinder-volume']['group'] in group_names) and (cinder_ceilometer_enabled | bool)) | ternary('started', 'stopped') }}"
options: options:
OnBootSec: 30min 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 Persistent: true
tags: tags:
- cinder-config - cinder-config
- import_tasks: cinder_db_sync.yml - name: Importing cinder_db_sync tasks
import_tasks: cinder_db_sync.yml
when: when:
- _cinder_is_first_api_play_host - _cinder_is_first_api_play_host
tags: tags:
@ -181,7 +193,8 @@
- cinder-config - cinder-config
- uwsgi - uwsgi
- include_role: - name: Including osa.service_setup role
include_role:
name: openstack.osa.service_setup name: openstack.osa.service_setup
apply: apply:
tags: tags:
@ -231,18 +244,20 @@
retries: 5 retries: 5
delay: 2 delay: 2
when: when:
- "cinder_services['cinder-volume']['group'] in group_names" - "cinder_services['cinder-volume']['group'] in group_names"
- name: Flush handlers - name: Flush handlers
meta: 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: when:
- "_cinder_is_last_play_host" - "_cinder_is_last_play_host"
tags: tags:
- cinder-config - cinder-config
- import_tasks: cinder_backends.yml - name: Importing cinder_backends tasks
import_tasks: cinder_backends.yml
when: when:
- "groups[cinder_services['cinder-volume']['group']] | length > 0" - "groups[cinder_services['cinder-volume']['group']] | length > 0"
- "_cinder_is_last_play_host" - "_cinder_is_last_play_host"

View File

@ -13,9 +13,21 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # 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_api_play_host: >-
_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_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: _cinder_rootwrap_conf_overrides:
DEFAULT: DEFAULT:
@ -136,4 +148,6 @@ _cinder_coordination_url: >-
groups[cinder_coordination_group] groups[cinder_coordination_group]
| map('extract', hostvars, 'ansible_host') | map('extract', hostvars, 'ansible_host')
| list | join(':' ~ cinder_coordination_port ~ ',') | 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 %}