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: Iaab0ad50fd65287094522f77283a0112859d7730
This commit is contained in:
Dmitriy Rabotyagov 2023-07-14 20:58:47 +02:00
parent c012c28a96
commit 045f45c12c
7 changed files with 100 additions and 50 deletions

View File

@ -17,14 +17,18 @@
# (c) 2016 Donovan Francesco <donovan.francesco@is.co.za> # (c) 2016 Donovan Francesco <donovan.francesco@is.co.za>
# (c) 2016 Paul Stevens <paul.stevens@is.co.za> # (c) 2016 Paul Stevens <paul.stevens@is.co.za>
#python venv executable # python venv executable
trove_venv_python_executable: "{{ openstack_venv_python_executable | default('python3') }}" trove_venv_python_executable: "{{ openstack_venv_python_executable | default('python3') }}"
# Set the host which will execute the shade modules # Set the host which will execute the shade modules
# 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.
trove_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}" trove_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}"
trove_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((trove_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}" trove_service_setup_host_python_interpreter: >-
{{
openstack_service_setup_host_python_interpreter | default(
(trove_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable']))
}}
trove_package_state: "{{ package_state | default('latest') }}" trove_package_state: "{{ package_state | default('latest') }}"
@ -67,7 +71,8 @@ trove_profiler_enabled: false
## Cap the maximum number of threads / workers when a user value is unspecified. ## Cap the maximum number of threads / workers when a user value is unspecified.
trove_api_workers_max: 16 trove_api_workers_max: 16
trove_api_workers: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, trove_api_workers_max] | min }}" trove_api_workers: >-
{{ [[(ansible_facts['processor_vcpus'] // ansible_facts['processor_threads_per_core']) | default(1), 1] | max * 2, trove_api_workers_max] | min }}
# uWSGI settings # uWSGI settings
trove_wsgi_threads: 1 trove_wsgi_threads: 1
@ -78,7 +83,8 @@ trove_uwsgi_tls:
## Cap the maximum number of threads / workers when a user value is unspecified. ## Cap the maximum number of threads / workers when a user value is unspecified.
trove_conductor_workers_max: 16 trove_conductor_workers_max: 16
trove_conductor_workers: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, trove_conductor_workers_max] | min }}" trove_conductor_workers: >-
{{ [[(ansible_facts['processor_vcpus'] // ansible_facts['processor_threads_per_core']) | default(1), 1] | max * 2, trove_conductor_workers_max] | min }}
# Enable/Disable Ceilometer # Enable/Disable Ceilometer
trove_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (groups['ceilometer_all'] | length > 0) }}" trove_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (groups['ceilometer_all'] | length > 0) }}"
@ -91,20 +97,28 @@ trove_bin: "/openstack/venvs/trove-{{ trove_venv_tag }}/bin"
trove_git_repo: "https://opendev.org/openstack/trove" trove_git_repo: "https://opendev.org/openstack/trove"
trove_git_install_branch: master trove_git_install_branch: master
trove_upper_constraints_url: "{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}" trove_upper_constraints_url: >-
{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}
trove_git_constraints: trove_git_constraints:
- "--constraint {{ trove_upper_constraints_url }}" - "--constraint {{ trove_upper_constraints_url }}"
# Database vars # Database vars
trove_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}" trove_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
trove_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((trove_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}" trove_db_setup_python_interpreter: >-
{{
openstack_db_setup_python_interpreter | default(
(trove_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable']))
}}
trove_galera_address: "{{ galera_address | default('127.0.0.1') }}" trove_galera_address: "{{ galera_address | default('127.0.0.1') }}"
trove_galera_database_name: trove trove_galera_database_name: trove
trove_galera_user: trove trove_galera_user: trove
trove_galera_use_ssl: "{{ galera_use_ssl | default(False) }}" trove_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
trove_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('') }}" trove_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('') }}"
trove_galera_port: "{{ galera_port | default('3306') }}" trove_galera_port: "{{ galera_port | default('3306') }}"
trove_galera_connection_string: "mysql+pymysql://{{ trove_galera_user}}:{{ trove_galera_password }}@{{ trove_galera_address }}:{{ trove_galera_port }}/{{ trove_galera_database_name }}?charset=utf8{% if trove_galera_use_ssl | bool %}&ssl_verify_cert=true{% if trove_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ trove_galera_ssl_ca_cert }}{% endif %}{% endif %}" trove_galera_connection_string: >-
mysql+pymysql://{{ trove_galera_user}}:{{ trove_galera_password }}@{{ trove_galera_address }}:{{ trove_galera_port }}/{{ trove_galera_database_name
}}?charset=utf8{% if trove_galera_use_ssl | bool %}&ssl_verify_cert=true{%
if trove_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ trove_galera_ssl_ca_cert }}{% endif %}{% endif %}
trove_db_max_overflow: "{{ openstack_db_max_overflow | default('50') }}" trove_db_max_overflow: "{{ openstack_db_max_overflow | default('50') }}"
trove_db_max_pool_size: "{{ openstack_db_max_pool_size | default('5') }}" trove_db_max_pool_size: "{{ openstack_db_max_pool_size | default('5') }}"
trove_db_pool_timeout: "{{ openstack_db_pool_timeout | default('30') }}" trove_db_pool_timeout: "{{ openstack_db_pool_timeout | default('30') }}"
@ -155,15 +169,28 @@ trove_rabbit_notification_topic: notification
# #
# The value of 'net_name' field of the provider network network to use for infrastructure services # The value of 'net_name' field of the provider network network to use for infrastructure services
trove_provider_net_name: dbaas-mgmt trove_provider_net_name: dbaas-mgmt
trove_provider_network: "{{ provider_networks|map(attribute='network')|selectattr('net_name','defined')|selectattr('net_name', 'equalto', trove_provider_net_name)|list|first }}" trove_provider_network: >-
{{
provider_networks | map(attribute='network') | selectattr('net_name','defined') | selectattr(
'net_name', 'equalto', trove_provider_net_name
) | list | first
}}
# The name of the network interface # The name of the network interface
trove_provider_net_iface: "{{ (is_metal | bool) | ternary(trove_provider_network['container_bridge'], trove_provider_network['container_interface']) }}" trove_provider_net_iface: "{{ (is_metal | bool) | ternary(trove_provider_network['container_bridge'], trove_provider_network['container_interface']) }}"
trove_guest_endpoint_type: public trove_guest_endpoint_type: public
trove_guest_rpc_host_group: "{{ oslomsg_rpc_host_group | default('rabbitmq_all') }}" trove_guest_rpc_host_group: "{{ oslomsg_rpc_host_group | default('rabbitmq_all') }}"
trove_guest_oslomsg_rpc_servers: "{{ groups[trove_guest_rpc_host_group] | map('extract', hostvars, 'ansible_facts') | map(attribute=trove_provider_net_iface | replace('-','_')) | map(attribute='ipv4.address') | join(',') }}" trove_guest_oslomsg_rpc_servers: >-
{{
groups[trove_guest_rpc_host_group] | map('extract', hostvars, 'ansible_facts') | map(attribute=trove_provider_net_iface | replace('-','_')
) | map(attribute='ipv4.address') | join(',')
}}
trove_guest_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}" trove_guest_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}"
trove_guest_notify_host_group: "{{ oslomsg_notify_host_group | default('rabbitmq_all') }}" trove_guest_notify_host_group: "{{ oslomsg_notify_host_group | default('rabbitmq_all') }}"
trove_guest_oslomsg_notify_servers: "{{ groups[trove_guest_notify_host_group] | map('extract', hostvars, 'ansible_facts') | map(attribute=trove_provider_net_iface | replace('-','_')) | map(attribute='ipv4.address') | join(',') }}" trove_guest_oslomsg_notify_servers: >-
{{
groups[trove_guest_notify_host_group] | map('extract', hostvars, 'ansible_facts') | map(attribute=trove_provider_net_iface | replace('-','_')
) | map(attribute='ipv4.address') | join(',')
}}
trove_guest_oslomsg_notify_use_ssl: "{{ oslomsg_notify_use_ssl | default(False) }}" trove_guest_oslomsg_notify_use_ssl: "{{ oslomsg_notify_use_ssl | default(False) }}"
# Trove image settings. # Trove image settings.
@ -187,7 +214,12 @@ trove_guestagent_images: []
trove_guest_auth_url: "{{ keystone_service_publicurl }}" trove_guest_auth_url: "{{ keystone_service_publicurl }}"
trove_guest_swift_url: "{{ trove_service_publicuri_proto }}://{{ external_lb_vip_address }}:{{ swift_proxy_port }}/v1/AUTH_" trove_guest_swift_url: "{{ trove_service_publicuri_proto }}://{{ external_lb_vip_address }}:{{ swift_proxy_port }}/v1/AUTH_"
trove_swift_enabled: "{{ (groups['swift_all'] is defined and groups['swift_all'] | length > 0) or (groups['ceph-rgw'] is defined and groups['ceph-rgw'] | length > 0) or (ceph_rgws is defined and ceph_rgws | length > 0) }}" trove_swift_enabled: >-
{{
(groups['swift_all'] is defined and groups['swift_all'] | length > 0) or
(groups['ceph-rgw'] is defined and groups['ceph-rgw'] | length > 0) or
(ceph_rgws is defined and ceph_rgws | length > 0)
}}
trove_designate_enabled: "{{ (groups['designate_all'] is defined and groups['designate_all'] | length > 0) }}" trove_designate_enabled: "{{ (groups['designate_all'] is defined and groups['designate_all'] | length > 0) }}"
trove_cinder_enabled: "{{ (groups['cinder_volume'] is defined and groups['cinder_volume'] | length > 0) }}" trove_cinder_enabled: "{{ (groups['cinder_volume'] is defined and groups['cinder_volume'] | length > 0) }}"
@ -244,7 +276,7 @@ trove_service_user_domain_name: Default
trove_service_project_domain_id: default trove_service_project_domain_id: default
trove_service_user_domain_id: default trove_service_user_domain_id: default
#Glance images # Glance images
trove_glance_images: [] trove_glance_images: []
trove_pip_packages: trove_pip_packages:
@ -347,5 +379,5 @@ trove_pki_install_certificates:
mode: "0600" mode: "0600"
# Define user-provided SSL certificates # Define user-provided SSL certificates
#trove_user_ssl_cert: <path to cert on ansible deployment host> # trove_user_ssl_cert: <path to cert on ansible deployment host>
#trove_user_ssl_key: <path to cert on ansible deployment host> # trove_user_ssl_key: <path to cert on ansible deployment host>

View File

@ -4,24 +4,25 @@ galaxy_info:
description: Deploy Trove with OpenStack Ansible description: Deploy Trove with OpenStack Ansible
company: OpenStack company: OpenStack
license: Apache-2.0 license: Apache-2.0
min_ansible_version: 2.2 min_ansible_version: "2.10"
version: 0.1.0 role_name: os_trove
namespace: openstack
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"
galaxy_tags: galaxy_tags:
- cloud - cloud
- openstack - openstack
- python - python
- trove - trove
dependencies: dependencies:
- role: apt_package_pinning - role: apt_package_pinning

View File

@ -40,7 +40,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:
@ -61,7 +62,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:
@ -83,7 +85,8 @@
tags: tags:
- always - always
- import_tasks: trove_pre_install.yml - name: Importing trove_pre_install tasks
import_tasks: trove_pre_install.yml
tags: tags:
- trove-install - trove-install
@ -125,18 +128,21 @@
tags: tags:
- trove-install - trove-install
- import_tasks: trove_service_network.yml - name: Importing trove_service_network tasks
import_tasks: trove_service_network.yml
tags: tags:
- trove-install - trove-install
- trove-config - trove-config
- include_tasks: trove_guest_image.yml - name: Including trove_guest_image tasks
include_tasks: trove_guest_image.yml
when: trove_guestagent_images | length > 0 when: trove_guestagent_images | length > 0
tags: tags:
- trove-install - trove-install
- trove-config - trove-config
- import_tasks: trove_post_install.yml - name: Importing trove_post_install tasks
import_tasks: trove_post_install.yml
tags: tags:
- trove-install - trove-install
- trove-config - trove-config
@ -150,10 +156,10 @@
systemd_tempd_prefix: openstack systemd_tempd_prefix: openstack
systemd_slice_name: trove systemd_slice_name: trove
systemd_lock_path: /var/lock/trove systemd_lock_path: /var/lock/trove
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: systemd_services:
- service_name: "{{ service_var.service_name }}" - service_name: "{{ service_var.service_name }}"
enabled: yes enabled: yes
@ -179,7 +185,8 @@
- trove-config - trove-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:
@ -216,7 +223,8 @@
tags: tags:
- always - always
- import_tasks: trove_db_sync.yml - name: Importing trove_db_sync tasks
import_tasks: trove_db_sync.yml
when: _trove_conductor_is_first_play_host when: _trove_conductor_is_first_play_host
tags: tags:
- trove-install - trove-install

View File

@ -32,6 +32,7 @@
url: "{{ item.file }}" url: "{{ item.file }}"
dest: "{{ trove_image_local_path }}/{{ item.file | basename }}" dest: "{{ trove_image_local_path }}/{{ item.file | basename }}"
checksum: "{{ item.checksum | default(omit) }}" checksum: "{{ item.checksum | default(omit) }}"
mode: "0644"
retries: 5 retries: 5
delay: 10 delay: 10
register: trove_download_images register: trove_download_images
@ -59,7 +60,7 @@
# This uses command since os_image doesn't support tags. # This uses command since os_image doesn't support tags.
# TODO(odyssey4me): # TODO(odyssey4me):
# Add tag capability to os_image module and replace this. # Add tag capability to os_image module and replace this.
- name: Upload new image to glance - name: Upload new image to glance # noqa: no-changed-when jinja[spacing]
command: >- command: >-
openstack image create openstack image create
--os-cloud {{ item.cloud | default('default') }} --os-cloud {{ item.cloud | default('default') }}

View File

@ -16,10 +16,10 @@
# (c) 2016 Donovan Francesco <donovan.francesco@is.co.za> # (c) 2016 Donovan Francesco <donovan.francesco@is.co.za>
# (c) 2016 Paul Stevens <paul.stevens@is.co.za> # (c) 2016 Paul Stevens <paul.stevens@is.co.za>
- name: Gathering network facts for {{ trove_provider_net_name }} interface - name: Gathering network facts for interface {{ trove_provider_net_name }}
setup: setup:
gather_subset: "!all,network" gather_subset: "!all,network"
filter: "{{ trove_address_gather_filter | default('ansible_' ~ trove_provider_net_iface | replace('-','_')) }}" filter: "{{ trove_address_gather_filter | default('ansible_' ~ trove_provider_net_iface | replace('-', '_')) }}"
delegate_to: "{{ item }}" delegate_to: "{{ item }}"
delegate_facts: true delegate_facts: true
with_items: "{{ (groups[trove_guest_rpc_host_group] + groups[trove_guest_notify_host_group]) | unique }}" with_items: "{{ (groups[trove_guest_rpc_host_group] + groups[trove_guest_notify_host_group]) | unique }}"

View File

@ -35,9 +35,9 @@
file: file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
owner: "{{ item.owner|default(trove_system_user_name) }}" owner: "{{ item.owner | default(trove_system_user_name) }}"
group: "{{ item.group|default(trove_system_group_name) }}" group: "{{ item.group | default(trove_system_group_name) }}"
mode: "{{ item.mode|default('0755') }}" mode: "{{ item.mode | default('0755') }}"
with_items: with_items:
- { path: "/openstack/venvs", owner: "root", group: "root" } - { path: "/openstack/venvs", owner: "root", group: "root" }
- { path: "/etc/trove" } - { path: "/etc/trove" }

View File

@ -13,8 +13,16 @@
# 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.
_trove_is_first_play_host: "{{ (trove_services['trove-api']['group'] in group_names and inventory_hostname == (groups[trove_services['trove-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }}" _trove_is_first_play_host: >-
_trove_conductor_is_first_play_host: "{{ (trove_services['trove-conductor']['group'] in group_names and inventory_hostname == (groups[trove_services['trove-conductor']['group']] | intersect(ansible_play_hosts)) | first) | bool }}" {{
(trove_services['trove-api']['group'] in group_names and
inventory_hostname == (groups[trove_services['trove-api']['group']] | intersect(ansible_play_hosts)) | first) | bool
}}
_trove_conductor_is_first_play_host: >-
{{
(trove_services['trove-conductor']['group'] in group_names and
inventory_hostname == (groups[trove_services['trove-conductor']['group']] | intersect(ansible_play_hosts)) | first) | bool
}}
filtered_trove_services: |- filtered_trove_services: |-
{% set services = [] %} {% set services = [] %}