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
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/888517
Change-Id: I53c0166beb446802641c701f6e43d5e317f9d54a
This commit is contained in:
Dmitriy Rabotyagov 2023-07-13 16:11:04 +02:00
parent eeb070c682
commit bf019ab6d7
9 changed files with 60 additions and 34 deletions

View File

@ -20,7 +20,11 @@ debug: False
# for the service setup. The host must already have
# clouds.yaml properly configured.
aodh_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}"
aodh_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((aodh_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
aodh_service_setup_host_python_interpreter: >-
{{
openstack_service_setup_host_python_interpreter | default(
(aodh_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable']))
}}
# Set the package install state for distribution packages
# Options are 'present' and 'latest'
@ -33,7 +37,8 @@ aodh_venv_python_executable: "{{ openstack_venv_python_executable | default('pyt
## The git source/branch
aodh_git_repo: https://opendev.org/openstack/aodh
aodh_git_install_branch: master
aodh_upper_constraints_url: "{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}"
aodh_upper_constraints_url: >-
{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}
aodh_git_constraints:
- "--constraint {{ aodh_upper_constraints_url }}"
@ -52,14 +57,21 @@ aodh_system_user_home: "/var/lib/{{ aodh_system_user_name }}"
## Database info
aodh_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
aodh_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((aodh_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
aodh_db_setup_python_interpreter: >-
{{
openstack_db_setup_python_interpreter | default(
(aodh_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable']))
}}
aodh_db_address: "{{ galera_address | default('127.0.0.1') }}"
aodh_database_name: aodh
aodh_database_user: aodh
aodh_db_type: "mysql+pymysql"
aodh_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
aodh_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('') }}"
aodh_connection_string: "{{ aodh_db_type }}://{{ aodh_database_user }}:{{ aodh_container_db_password }}@{{ aodh_db_address }}:{{ aodh_galera_port }}/{{ aodh_database_name }}?charset=utf8{% if aodh_galera_use_ssl | bool %}&ssl_verify_cert=true{% if aodh_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ aodh_galera_ssl_ca_cert }}{% endif %}{% endif %}"
aodh_connection_string: >-
{{ aodh_db_type }}://{{ aodh_database_user }}:{{ aodh_container_db_password }}@{{ aodh_db_address }}:{{ aodh_galera_port }}/{{ aodh_database_name
}}?charset=utf8{% if aodh_galera_use_ssl | bool %}&ssl_verify_cert=true{%
if aodh_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ aodh_galera_ssl_ca_cert }}{% endif %}{% endif %}
aodh_galera_port: "{{ galera_port | default('3306') }}"
aodh_db_max_overflow: "{{ openstack_db_max_overflow | default('50') }}"
aodh_db_max_pool_size: "{{ openstack_db_max_pool_size | default('5') }}"
@ -99,12 +111,13 @@ aodh_oslomsg_amqp1_enabled: "{{ aodh_oslomsg_rpc_transport == 'amqp' }}"
## uWSGI setup
aodh_wsgi_threads: 1
aodh_wsgi_processes_max: 16
aodh_wsgi_processes: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, aodh_wsgi_processes_max] | min }}"
aodh_wsgi_processes: >-
{{ [[(ansible_facts['processor_vcpus'] // ansible_facts['processor_threads_per_core']) | default(1), 1] | max * 2, aodh_wsgi_processes_max] | min }}
aodh_uwsgi_tls:
crt: "{{ aodh_ssl_cert }}"
key: "{{ aodh_ssl_key }}"
#Aodh services info
# Aodh services info
aodh_service_role_names:
- admin
- service
@ -255,5 +268,5 @@ aodh_pki_install_certificates:
mode: "0600"
# Define user-provided SSL certificates
#aodh_user_ssl_cert: <path to cert on ansible deployment host>
#aodh_user_ssl_key: <path to cert on ansible deployment host>
# aodh_user_ssl_cert: <path to cert on ansible deployment host>
# aodh_user_ssl_key: <path to cert on ansible deployment host>

View File

@ -18,19 +18,21 @@ galaxy_info:
description: Installation and setup of aodh
company: Rackspace
license: Apache2
min_ansible_version: 2.2
role_name: os_aodh
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
- ceilometer

View File

@ -19,6 +19,7 @@
section: "aodh"
option: "install_method"
value: "{{ aodh_install_method }}"
mode: "0644"
- name: Refresh local facts to ensure the aodh section is present
setup:

View File

@ -33,9 +33,9 @@
file:
path: "{{ item.path }}"
state: directory
owner: "{{ item.owner|default(aodh_system_user_name) }}"
group: "{{ item.group|default(aodh_system_group_name) }}"
mode: "{{ item.mode|default('0755') }}"
owner: "{{ item.owner | default(aodh_system_user_name) }}"
group: "{{ item.group | default(aodh_system_group_name) }}"
mode: "{{ item.mode | default('0755') }}"
with_items:
- { path: "/openstack/venvs", mode: "0755", owner: "root", group: "root" }
- { path: "/etc/aodh" }

View File

@ -51,7 +51,8 @@
tags:
- always
- include_role:
- name: Including osa.db_setup role
include_role:
name: openstack.osa.db_setup
apply:
tags:
@ -72,12 +73,13 @@
tags:
- always
- include_role:
- name: Including osa.mq_setup role
include_role:
name: openstack.osa.mq_setup
apply:
tags:
- common-mq
- aodh-config
- common-mq
- aodh-config
when:
- _aodh_is_first_play_host
vars:
@ -94,11 +96,13 @@
tags:
- always
- import_tasks: aodh_pre_install.yml
- name: Importing aodh_pre_install install
import_tasks: aodh_pre_install.yml
tags:
- aodh-install
- import_tasks: aodh_install.yml
- name: Importing aodh_install install
import_tasks: aodh_install.yml
tags:
- aodh-install
@ -122,7 +126,8 @@
tags:
- always
- import_tasks: aodh_post_install.yml
- name: Importing aodh_post_install tasks
import_tasks: aodh_post_install.yml
tags:
- aodh-config
@ -135,16 +140,17 @@
systemd_tempd_prefix: openstack
systemd_slice_name: aodh
systemd_lock_path: /var/lock/aodh
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_aodh_services }}"
tags:
- aodh-config
- systemd-service
- import_tasks: aodh_db_sync.yml
- name: Importing aodh_db_sync tasks
import_tasks: aodh_db_sync.yml
when:
- _aodh_is_first_play_host
tags:
@ -160,7 +166,8 @@
- aodh-config
- uwsgi
- include_role:
- name: Including osa.service_setup roles
include_role:
name: openstack.osa.service_setup
apply:
tags:

View File

@ -14,7 +14,7 @@
# limitations under the License.
aodh_package_list: |-
{% set packages = (aodh_distro_packages + aodh_service_distro_packages) %}
{% set packages = aodh_distro_packages + aodh_service_distro_packages %}
{% if aodh_oslomsg_amqp1_enabled | bool %}
{% set _ = packages.extend(aodh_oslomsg_amqp1_distro_packages) %}
{% endif %}

View File

@ -13,7 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
_aodh_is_first_play_host: "{{ (aodh_services['aodh-api']['group'] in group_names and inventory_hostname == (groups[aodh_services['aodh-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }}"
_aodh_is_first_play_host: >-
{{
(aodh_services['aodh-api']['group'] in group_names and
inventory_hostname == (groups[aodh_services['aodh-api']['group']] | intersect(ansible_play_hosts)) | first) | bool
}}
filtered_aodh_services: |-
{% set services = [] %}
@ -53,4 +57,4 @@ uwsgi_aodh_services: |-
{% set _ = services.update({key: value}) %}
{% endif %}
{% endfor %}
{{ services }}
{{ services }}

View File

@ -41,4 +41,3 @@ aodh_oslomsg_amqp1_distro_packages:
- cyrus-sasl-lib
- cyrus-sasl-plain
- cyrus-sasl-md5

View File

@ -14,7 +14,7 @@
# limitations under the License.
aodh_package_list: |-
{% set packages = (aodh_distro_packages) %}
{% set packages = aodh_distro_packages %}
{% if aodh_oslomsg_amqp1_enabled | bool %}
{% set _ = packages.extend(aodh_oslomsg_amqp1_distro_packages) %}
{% endif %}