From fc0da79db5a884f230ae041827f2e0003c36f4d9 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 14 Jul 2023 18:33:14 +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: I7163d2e68b1f0f97bd31d7734a99f74ed60b1bb5 --- defaults/main.yml | 22 ++++++++++++++++------ meta/main.yml | 12 +++++++----- tasks/main.yml | 26 ++++++++++++++++---------- tasks/masakari_pre_install.yml | 8 ++++---- vars/main.yml | 8 ++++++-- 5 files changed, 49 insertions(+), 27 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 299e22c..f6705ec 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -20,7 +20,11 @@ debug: False # for the service setup. The host must already have # clouds.yaml properly configured. masakari_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}" -masakari_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((masakari_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}" +masakari_service_setup_host_python_interpreter: >- + {{ + openstack_service_setup_host_python_interpreter | default( + (masakari_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) + }} masakari_venv_python_executable: "{{ openstack_venv_python_executable | default('python3') }}" # Set the package install state for distribution packages @@ -31,7 +35,8 @@ masakari_git_repo: https://opendev.org/openstack/masakari masakari_monitors_git_repo: https://opendev.org/openstack/masakari-monitors masakari_git_install_branch: master masakari_monitors_git_install_branch: master -masakari_upper_constraints_url: "{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}" +masakari_upper_constraints_url: >- + {{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }} masakari_git_constraints: - "--constraint {{ masakari_upper_constraints_url }}" @@ -44,7 +49,11 @@ masakari_system_user_home: "/var/lib/{{ masakari_system_user_name }}" ## Database credentials masakari_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}" -masakari_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((masakari_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}" +masakari_db_setup_python_interpreter: >- + {{ + openstack_db_setup_python_interpreter | default( + (masakari_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) + }} masakari_galera_address: "{{ galera_address | default('127.0.0.1') }}" masakari_galera_database: masakari masakari_galera_user: masakari @@ -187,7 +196,8 @@ masakari_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}" # Notify masakari_oslomsg_notify_host_group: "{{ oslomsg_notify_host_group | default('rabbitmq_all') }}" -masakari_oslomsg_notify_setup_host: "{{ (masakari_oslomsg_notify_host_group in groups) | ternary(groups[masakari_oslomsg_notify_host_group][0], 'localhost') }}" +masakari_oslomsg_notify_setup_host: >- + {{ (masakari_oslomsg_notify_host_group in groups) | ternary(groups[masakari_oslomsg_notify_host_group][0], 'localhost') }} masakari_oslomsg_notify_transport: "{{ oslomsg_notify_transport | default('rabbit') }}" masakari_oslomsg_notify_servers: "{{ oslomsg_notify_servers | default('127.0.0.1') }}" masakari_oslomsg_notify_port: "{{ oslomsg_notify_port | default('5672') }}" @@ -255,5 +265,5 @@ masakari_pki_install_certificates: mode: "0600" # Define user-provided SSL certificates -#masakari_user_ssl_cert: -#masakari_user_ssl_key: +# masakari_user_ssl_cert: +# masakari_user_ssl_key: diff --git a/meta/main.yml b/meta/main.yml index fbd3edd..0f7ed26 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -18,19 +18,21 @@ galaxy_info: description: Installation and setup of masakari company: NTT DATA license: Apache2 - min_ansible_version: 2.2 + role_name: os_masakari + 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 - masakari diff --git a/tasks/main.yml b/tasks/main.yml index d363e66..c137403 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -28,7 +28,8 @@ tags: - always -- include_role: +- name: Including osa.db_setup role + include_role: name: openstack.osa.db_setup apply: tags: @@ -49,7 +50,8 @@ tags: - always -- include_role: +- name: Including osa.mq_setup role + include_role: name: openstack.osa.mq_setup apply: tags: @@ -71,7 +73,8 @@ tags: - always -- import_tasks: masakari_pre_install.yml +- name: Importing masakari_pre_install tasks + import_tasks: masakari_pre_install.yml tags: - masakari-install @@ -115,7 +118,8 @@ tags: - masakari-install -- import_tasks: masakari_post_install.yml +- name: Importing masakari_post_install tasks + import_tasks: masakari_post_install.yml tags: - masakari-config @@ -128,10 +132,10 @@ systemd_tempd_prefix: openstack systemd_slice_name: masakari systemd_lock_path: /var/lock/masakari - 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: |- {% set services = [] %} {% for service in masakari_services.values() %} @@ -151,11 +155,13 @@ - masakari-config - systemd-service -- import_tasks: masakari_db_sync.yml +- name: Importing masakari_db_sync tasks + import_tasks: masakari_db_sync.yml when: - "_masakari_is_first_play_host" -- include_role: +- name: Including osa.service_setup role + include_role: name: openstack.osa.service_setup apply: tags: diff --git a/tasks/masakari_pre_install.yml b/tasks/masakari_pre_install.yml index d0be707..79854bb 100644 --- a/tasks/masakari_pre_install.yml +++ b/tasks/masakari_pre_install.yml @@ -13,7 +13,7 @@ # 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: "{{ masakari_system_group_name }}" gid: "{{ masakari_system_group_gid | default(omit) }}" @@ -35,9 +35,9 @@ file: path: "{{ item.path | realpath }}" state: directory - owner: "{{ item.owner|default(masakari_system_user_name) }}" - group: "{{ item.group|default(masakari_system_group_name) }}" - mode: "{{ item.mode|default(omit) }}" + owner: "{{ item.owner | default(masakari_system_user_name) }}" + group: "{{ item.group | default(masakari_system_group_name) }}" + mode: "{{ item.mode | default(omit) }}" when: item.condition | default(True) with_items: - path: "/openstack" diff --git a/vars/main.yml b/vars/main.yml index d05f699..3de86b9 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -13,7 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -_masakari_is_first_play_host: "{{ (masakari_services['masakari-api']['group'] in group_names and inventory_hostname == (groups[masakari_services['masakari-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }}" +_masakari_is_first_play_host: >- + {{ + (masakari_services['masakari-api']['group'] in group_names and + inventory_hostname == (groups[masakari_services['masakari-api']['group']] | intersect(ansible_play_hosts)) | first) | bool + }} masakari_pip_venv_packages: |- {% set pip_packages = [] %} @@ -24,6 +28,6 @@ masakari_pip_venv_packages: |- {% set _ = pip_packages.extend(masakari_monitor_pip_packages) %} {% endif %} {% if masakari_oslomsg_amqp1_enabled | bool %} - {% set _ = pip_packages.extend(masakari_optional_oslomsg_amqp1_pip_packages) %} + {% set _ = pip_packages.extend(masakari_optional_oslomsg_amqp1_pip_packages) %} {% endif %} {{ pip_packages }}