From ee7a011b2f636f960bc69ca9ad6da31c6ffaa598 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Thu, 13 Jul 2023 15:55:45 +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: I558a0fee0b0bf8c86f5bd73dca2b9571f3e4e287 --- defaults/main.yml | 24 +++++++++++++++++------- meta/main.yml | 12 ++++++------ tasks/adjutant_pre_install.yml | 6 +++--- tasks/main.yml | 26 ++++++++++++++++---------- vars/main.yml | 6 +++++- 5 files changed, 47 insertions(+), 27 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index faa6b21..c12a211 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -33,7 +33,8 @@ adjutant_bin: "/openstack/venvs/adjutant-{{ adjutant_venv_tag }}/bin" adjutant_git_repo: https://opendev.org/openstack/adjutant adjutant_git_install_branch: master -adjutant_upper_constraints_url: "{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}" +adjutant_upper_constraints_url: >- + {{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }} adjutant_git_constraints: - "--constraint {{ adjutant_upper_constraints_url }}" @@ -48,7 +49,11 @@ adjutant_galera_use_ssl: "{{ galera_use_ssl | default(False) }}" adjutant_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('/etc/ssl/certs/galera-ca.pem') }}" adjutant_galera_port: "{{ galera_port | default('3306') }}" adjutant_galera_setup_host: "{{ openstack_db_setup_host | default('localhost') }}" -adjutant_galera_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((adjutant_galera_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}" +adjutant_galera_setup_python_interpreter: >- + {{ + openstack_db_setup_python_interpreter | default( + (adjutant_galera_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) + }} ## Service Type and Data adjutant_role_name: admin @@ -60,7 +65,11 @@ adjutant_service_port: 5050 adjutant_service_project_name: service adjutant_service_in_ldap: "{{ service_ldap_backend_enabled | default(False) }}" adjutant_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}" -adjutant_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((adjutant_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}" +adjutant_service_setup_host_python_interpreter: >- + {{ + openstack_service_setup_host_python_interpreter | default( + (adjutant_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) + }} adjutant_bind_address: "{{ openstack_service_bind_address | default('0.0.0.0') }}" adjutant_service_proto: http adjutant_service_publicuri_proto: "{{ openstack_service_publicuri_proto | default(adjutant_service_proto) }}" @@ -77,7 +86,8 @@ adjutant_horizon_publicurl: "{{ openstack_service_publicuri_proto | default(adju # uWSGI settings adjutant_wsgi_threads: 1 adjutant_wsgi_processes_max: 16 -adjutant_wsgi_processes: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, adjutant_wsgi_processes_max] | min }}" +adjutant_wsgi_processes: >- + {{ [[(ansible_facts['processor_vcpus'] // ansible_facts['processor_threads_per_core']) | default(1), 1] | max * 2, adjutant_wsgi_processes_max] | min }} adjutant_use_uwsgi: True adjutant_uwsgi_tls: crt: "{{ adjutant_ssl_cert }}" @@ -263,7 +273,7 @@ adjutant_pip_packages: - systemd-python adjutant_pip_extra_packages: - - mysqlclient + - mysqlclient ### ### Backend TLS @@ -310,5 +320,5 @@ adjutant_pki_install_certificates: mode: "0600" # Define user-provided SSL certificates -#adjutant_user_ssl_cert: -#adjutant_user_ssl_key: +# adjutant_user_ssl_cert: +# adjutant_user_ssl_key: diff --git a/meta/main.yml b/meta/main.yml index cb1b7ce..2ab28a2 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -18,17 +18,17 @@ galaxy_info: description: Installation and setup of Adjutant company: ELASTX license: Apache2 - min_ansible_version: 2.2 + role_name: os_adjutant + namespace: openstack + min_ansible_version: "2.10" platforms: - name: Ubuntu versions: - - xenial - categories: + - focal + - jammy + galaxy_tags: - cloud - python - adjutant - development - openstack -dependencies: - - apt_package_pinning - - openstack_openrc diff --git a/tasks/adjutant_pre_install.yml b/tasks/adjutant_pre_install.yml index 9c5ad7e..5c883be 100644 --- a/tasks/adjutant_pre_install.yml +++ b/tasks/adjutant_pre_install.yml @@ -35,9 +35,9 @@ file: path: "{{ item.path }}" state: directory - owner: "{{ item.owner|default(adjutant_system_user_name) }}" - group: "{{ item.group|default(adjutant_system_group_name) }}" - mode: "{{ item.mode|default('0755') }}" + owner: "{{ item.owner | default(adjutant_system_user_name) }}" + group: "{{ item.group | default(adjutant_system_group_name) }}" + mode: "{{ item.mode | default('0755') }}" with_items: - { path: "/openstack", mode: "0755", owner: "root", group: "root" } - { path: "/etc/adjutant" } diff --git a/tasks/main.yml b/tasks/main.yml index 16c42f4..c8cc1fd 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -30,7 +30,8 @@ tags: - always -- include_role: +- name: Including osa.db_setup role + include_role: name: openstack.osa.db_setup apply: tags: @@ -50,11 +51,13 @@ tags: - always -- import_tasks: adjutant_pre_install.yml +- name: Importing adjutant_pre_install tasks + import_tasks: adjutant_pre_install.yml tags: - adjutant-install -- import_tasks: adjutant_install.yml +- name: Importing adjutant_install tasks + import_tasks: adjutant_install.yml tags: - adjutant-install @@ -78,16 +81,19 @@ tags: - always -- import_tasks: adjutant_post_install.yml +- name: Importing adjutant_post_install tasks + import_tasks: adjutant_post_install.yml tags: - adjutant-config -- import_tasks: adjutant_db_sync.yml +- name: Importing adjutant_db_sync tasks + import_tasks: adjutant_db_sync.yml when: _adjutant_is_first_play_host tags: - adjutant-config -- include_role: +- name: Including osa.service_setup role + include_role: name: openstack.osa.service_setup apply: tags: @@ -133,10 +139,10 @@ systemd_tempd_prefix: openstack systemd_slice_name: adjutant systemd_lock_path: /var/lock/adjutant - systemd_CPUAccounting: true - systemd_BlockIOAccounting: true - systemd_MemoryAccounting: true - systemd_TasksAccounting: true + systemd_service_cpu_accounting: true + systemd_service_block_io_accounting: true + systemd_memory_accounting: true + systemd_tasks_accounting: true systemd_services: - service_name: "{{ service_var.service_name }}" enabled: "{{ service_var.enabled | default(True) }}" diff --git a/vars/main.yml b/vars/main.yml index b931bc9..185087e 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. -_adjutant_is_first_play_host: "{{ (adjutant_services['adjutant-api']['group'] in group_names and inventory_hostname == (groups[adjutant_services['adjutant-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }}" +_adjutant_is_first_play_host: >- + {{ + (adjutant_services['adjutant-api']['group'] in group_names and + inventory_hostname == (groups[adjutant_services['adjutant-api']['group']] | intersect(ansible_play_hosts)) | first) | bool + }} filtered_adjutant_services: |- {% set services = [] %}