From 94e581739149622f67076f1122694926b0213659 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 14 Jul 2023 15:21:35 +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: I68a3041edf0b0eb891fbe1e40081f779fc40c21d --- defaults/main.yml | 30 ++++++++++++++++++++---------- meta/main.yml | 12 +++++++----- tasks/heat_install.yml | 1 + tasks/heat_pre_install.yml | 8 ++++---- tasks/heat_service_setup.yml | 3 ++- tasks/main.yml | 29 ++++++++++++++++++----------- vars/main.yml | 6 +++++- 7 files changed, 57 insertions(+), 32 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 0c4cc9b..0cf0cb3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -26,7 +26,11 @@ debug: False # for the service setup. The host must already have # clouds.yaml properly configured. heat_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}" -heat_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((heat_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}" +heat_service_setup_host_python_interpreter: >- + {{ + openstack_service_setup_host_python_interpreter | default( + (heat_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' @@ -38,7 +42,8 @@ heat_venv_python_executable: "{{ openstack_venv_python_executable | default('pyt heat_git_repo: https://opendev.org/openstack/heat heat_git_install_branch: master -heat_upper_constraints_url: "{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}" +heat_upper_constraints_url: >- + {{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }} heat_git_constraints: - "--constraint {{ heat_upper_constraints_url }}" @@ -55,7 +60,11 @@ heat_clients_heat_endpoint: publicURL ## Database info heat_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}" -heat_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((heat_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}" +heat_db_setup_python_interpreter: >- + {{ + openstack_db_setup_python_interpreter | default( + (heat_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) + }} heat_galera_address: "{{ galera_address | default('127.0.0.1') }}" heat_galera_user: heat heat_galera_database: heat @@ -192,7 +201,8 @@ heat_metadata_server_url: "{{ heat_cfn_service_publicuri_proto }}://{{ external_ ## Cap the maximum number of threads / workers when a user value is unspecified. heat_api_threads_max: 16 -heat_api_threads: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, heat_api_threads_max] | min }}" +heat_api_threads: >- + {{ [[(ansible_facts['processor_vcpus'] // ansible_facts['processor_threads_per_core']) | default(1), 1] | max * 2, heat_api_threads_max] | min }} heat_service_in_ldap: "{{ service_ldap_backend_enabled | default(False) }}" @@ -204,9 +214,9 @@ heat_plugin_dirs: ## Policy vars # Provide a list of access controls to update the default policy.json with. These changes will be merged # with the access controls in the default policy.json. E.g. -#heat_policy_overrides: -# "cloudformation:ListStacks": "rule:deny_stack_user" -# "cloudformation:CreateStack": "rule:deny_stack_user" +# heat_policy_overrides: +# "cloudformation:ListStacks": "rule:deny_stack_user" +# "cloudformation:CreateStack": "rule:deny_stack_user" # Common pip packages heat_pip_packages: @@ -285,7 +295,7 @@ heat_required_secrets: heat_api_uwsgi_ini_overrides: {} heat_api_cfn_uwsgi_ini_overrides: {} heat_wsgi_processes_max: 16 -heat_wsgi_processes: "{{ [[ansible_facts['processor_vcpus']|default(1), 1] | max * 2, heat_wsgi_processes_max] | min }}" +heat_wsgi_processes: "{{ [[ansible_facts['processor_vcpus'] | default(1), 1] | max * 2, heat_wsgi_processes_max] | min }}" heat_wsgi_threads: 1 heat_api_uwsgi_bind_address: "{{ openstack_service_bind_address | default('0.0.0.0') }}" heat_api_cfn_uwsgi_bind_address: "{{ openstack_service_bind_address | default('0.0.0.0') }}" @@ -346,5 +356,5 @@ heat_pki_install_certificates: mode: "0600" # Define user-provided SSL certificates -#heat_user_ssl_cert: -#heat_user_ssl_key: +# heat_user_ssl_cert: +# heat_user_ssl_key: diff --git a/meta/main.yml b/meta/main.yml index 92e1d9f..52cf341 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -18,19 +18,21 @@ galaxy_info: description: Installation and setup of heat company: Rackspace license: Apache2 - min_ansible_version: 2.2 + role_name: os_heat + 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 - heat diff --git a/tasks/heat_install.yml b/tasks/heat_install.yml index bcf73af..35a6c4a 100644 --- a/tasks/heat_install.yml +++ b/tasks/heat_install.yml @@ -19,6 +19,7 @@ section: "heat" option: "install_method" value: "{{ heat_install_method }}" + mode: "0644" - name: Refresh local facts to ensure the heat section is present setup: diff --git a/tasks/heat_pre_install.yml b/tasks/heat_pre_install.yml index 7fac3f6..827f227 100644 --- a/tasks/heat_pre_install.yml +++ b/tasks/heat_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: "{{ heat_system_group_name }}" state: "present" @@ -56,8 +56,8 @@ src: "{{ item.src | default(omit) }}" dest: "{{ item.dest | default(omit) }}" state: "{{ item.state | default('directory') }}" - owner: "{{ item.owner|default(heat_system_user_name) }}" - group: "{{ item.group|default(heat_system_group_name) }}" + owner: "{{ item.owner | default(heat_system_user_name) }}" + group: "{{ item.group | default(heat_system_group_name) }}" mode: "{{ item.mode | default(omit) }}" force: "{{ item.force | default(omit) }}" when: @@ -91,5 +91,5 @@ state: directory owner: "{{ heat_system_user_name }}" group: "{{ heat_system_group_name }}" - mode: "{{ item.mode|default('0755') }}" + mode: "{{ item.mode | default('0755') }}" with_items: "{{ heat_plugin_dirs }}" diff --git a/tasks/heat_service_setup.yml b/tasks/heat_service_setup.yml index 9b32504..0703148 100644 --- a/tasks/heat_service_setup.yml +++ b/tasks/heat_service_setup.yml @@ -19,7 +19,8 @@ # is to another host, we assume that it is accessible by the # system python instead. -- include_role: +- name: Including osa.service_setup role + include_role: name: openstack.osa.service_setup apply: tags: diff --git a/tasks/main.yml b/tasks/main.yml index a037de1..463cff8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -51,7 +51,8 @@ tags: - always -- include_role: +- name: Including osa.db_setup role + include_role: name: openstack.osa.db_setup apply: tags: @@ -72,7 +73,8 @@ tags: - always -- include_role: +- name: Including osa.mq_setup role + include_role: name: openstack.osa.mq_setup apply: tags: @@ -94,11 +96,13 @@ tags: - always -- import_tasks: heat_pre_install.yml +- name: Importing heat_pre_install tasks + import_tasks: heat_pre_install.yml tags: - heat-install -- import_tasks: heat_install.yml +- name: Importing heat_install tasks + import_tasks: heat_install.yml tags: - heat-install @@ -122,7 +126,8 @@ tags: - always -- import_tasks: heat_post_install.yml +- name: Importing heat_post_install tasks + import_tasks: heat_post_install.yml tags: - heat-config @@ -135,16 +140,17 @@ systemd_tempd_prefix: openstack systemd_slice_name: heat systemd_lock_path: /var/lock/heat - 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_heat_services }}" tags: - heat-config - systemd-service -- import_tasks: heat_db_sync.yml +- name: Importing heat_db_sync tasks + import_tasks: heat_db_sync.yml when: - "_heat_is_first_play_host" tags: @@ -160,7 +166,8 @@ - heat-config - uwsgi -- import_tasks: heat_service_setup.yml +- name: Importing heat_service_setup tasks + import_tasks: heat_service_setup.yml when: - "_heat_is_first_play_host" tags: diff --git a/vars/main.yml b/vars/main.yml index 2930ed5..02667eb 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. -_heat_is_first_play_host: "{{ (heat_services['heat-api']['group'] in group_names and inventory_hostname == (groups[heat_services['heat-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }}" +_heat_is_first_play_host: >- + {{ + (heat_services['heat-api']['group'] in group_names and inventory_hostname == ( + groups[heat_services['heat-api']['group']] | intersect(ansible_play_hosts)) | first) | bool + }} # # Compile a list of the services on a host based on whether