From dddc6651652315b4de7f7948bab99c7b1cb51c41 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 14 Jul 2023 21:30:29 +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: Ice967ef99da11e6bd5a7dffc0a5e3d377f8598f4 --- defaults/main.yml | 35 +++++++++++++++++++++++------------ meta/main.yml | 13 +++++++------ tasks/main.yml | 26 ++++++++++++++++---------- tasks/zun_compute.yml | 3 ++- tasks/zun_pre_install.yml | 2 +- vars/debian.yml | 4 +++- 6 files changed, 52 insertions(+), 31 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 16c1a66..00bd7d5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -26,14 +26,18 @@ zun_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (groups['c ## Verbosity Options debug: False -#python venv executable +# python venv executable zun_venv_python_executable: "{{ openstack_venv_python_executable | default('python3') }}" # Set the host which will execute the shade modules # for the service setup. The host must already have # clouds.yaml properly configured. zun_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}" -zun_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((zun_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}" +zun_service_setup_host_python_interpreter: >- + {{ + openstack_service_setup_host_python_interpreter | default( + (zun_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' @@ -50,7 +54,8 @@ zun_kuryr_git_install_branch: master zun_kuryr_lib_git_repo: https://opendev.org/openstack/kuryr zun_kuryr_lib_git_install_branch: master -zun_upper_constraints_url: "{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}" +zun_upper_constraints_url: >- + {{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }} zun_git_constraints: - "--constraint {{ zun_upper_constraints_url }}" @@ -85,7 +90,8 @@ zun_kuryr_log_dir: "/var/log/kuryr" zun_docker_package_version: "{{ _zun_docker_package_version }}" zun_containerd_package_version: "{{ _zun_containerd_package_version }}" zun_kata_package_version: "3.1.0" -zun_kata_package_source: "https://github.com/kata-containers/kata-containers/releases/download/{{ zun_kata_package_version }}/kata-static-{{ zun_kata_package_version }}-x86_64.tar.xz" +zun_kata_package_source: >- + https://github.com/kata-containers/kata-containers/releases/download/{{ zun_kata_package_version }}/kata-static-{{ zun_kata_package_version }}-x86_64.tar.xz zun_kata_package_checksum: sha256:452cc850e021539c14359d016aba18ddba128f59aa9ab637738296d9b5cd78a0 zun_kata_enabled: "True" @@ -124,7 +130,11 @@ zun_docker_prune_frequency: hour ## Database info zun_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}" -zun_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((zun_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}" +zun_db_setup_python_interpreter: >- + {{ + openstack_db_setup_python_interpreter | default((zun_db_setup_host == 'localhost') | ternary( + ansible_playbook_python, ansible_facts['python']['executable'])) + }} zun_galera_address: "{{ galera_address | default('127.0.0.1') }}" zun_galera_user: zun zun_galera_database: zun @@ -173,7 +183,7 @@ zun_oslomsg_notify_ssl_version: "{{ oslomsg_notify_ssl_version | default('TLSv1_ zun_oslomsg_notify_ssl_ca_file: "{{ oslomsg_notify_ssl_ca_file | default('') }}" # If this is not set, then the playbook will try to guess it. -#zun_virt_type: kvm +# zun_virt_type: kvm ## Zun Auth zun_service_region: "{{ service_region | default('RegionOne') }}" @@ -242,7 +252,8 @@ zun_container_runtime: runc ## Cap the maximun number of threads / workers when a user value is unspecified. zun_api_threads_max: 16 -zun_api_threads: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, zun_api_threads_max] | min }}" +zun_api_threads: >- + {{ [[(ansible_facts['processor_vcpus'] // ansible_facts['processor_threads_per_core']) | default(1), 1] | max * 2, zun_api_threads_max] | min }} zun_service_in_ldap: "{{ service_ldap_backend_enabled | default(False) }}" @@ -255,7 +266,7 @@ zun_scheduler_driver: filter_scheduler ## uWSGI setup zun_wsgi_threads: 1 zun_wsgi_processes_max: 16 -zun_wsgi_processes: "{{ [[ansible_facts['processor_vcpus']|default(1), 1] | max * 2, zun_wsgi_processes_max] | min }}" +zun_wsgi_processes: "{{ [[ansible_facts['processor_vcpus'] | default(1), 1] | max * 2, zun_wsgi_processes_max] | min }}" ## Service Name-Group Mapping zun_services: @@ -307,7 +318,7 @@ zun_services: state: started options: OnBootSec: 30min - OnCalendar: "{{ (zun_docker_prune_frequency == 'day') | ternary('daily', zun_docker_prune_frequency+'ly') }}" + OnCalendar: "{{ (zun_docker_prune_frequency == 'day') | ternary('daily', zun_docker_prune_frequency + 'ly') }}" Persistent: true docker: group: zun_compute @@ -379,7 +390,7 @@ zun_docker_init_defaults: Service: ExecStart: - "" - - "/usr/bin/dockerd --group {{ zun_system_group_name }} -H tcp://{{ zun_docker_bind_host }}:{{ zun_docker_bind_port }} -H unix:///var/run/docker.sock --cluster-store {{ zun_docker_kv_storage }}://{% for item in groups[zun_docker_kv_group] %}{{ hostvars[item]['management_address'] }}:{{ zun_docker_kv_port }}{% if not loop.last %},{% endif %}{% endfor %}{% if zun_kata_enabled %} --add-runtime kata=/opt/kata/bin/kata-runtime{% endif %}" + - "/usr/bin/dockerd --group {{ zun_system_group_name }} -H tcp://{{ zun_docker_bind_host }}:{{ zun_docker_bind_port }} -H unix:///var/run/docker.sock --cluster-store {{ zun_docker_kv_storage }}://{% for item in groups[zun_docker_kv_group] %}{{ hostvars[item]['management_address'] }}:{{ zun_docker_kv_port }}{% if not loop.last %},{% endif %}{% endfor %}{% if zun_kata_enabled %} --add-runtime kata=/opt/kata/bin/kata-runtime{% endif %}" # noqa: yaml[line-length] ## Tunable overrides for service unit files. zun_api_paste_ini_overrides: {} @@ -436,5 +447,5 @@ zun_pki_install_certificates: mode: "0600" # Define user-provided SSL certificates -#zun_user_ssl_cert: -#zun_user_ssl_key: +# zun_user_ssl_cert: +# zun_user_ssl_key: diff --git a/meta/main.yml b/meta/main.yml index d361dcb..97a7d21 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -18,22 +18,23 @@ galaxy_info: description: Installation and setup of zun company: Rackspace license: Apache2 - min_ansible_version: 2.4 + role_name: os_zun + namespace: openstack + min_ansible_version: "2.10" platforms: - name: Debian versions: - - buster + - bullseye - name: Ubuntu versions: - focal + - jammy - name: EL versions: - - 8 - categories: + - "9" + galaxy_tags: - cloud - python - zun - development - openstack -dependencies: - - apt_package_pinning diff --git a/tasks/main.yml b/tasks/main.yml index 5c70d27..0b49e95 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -29,7 +29,8 @@ tags: - always -- import_tasks: zun_pre_install.yml +- name: Importing zun_pre_install tasks + import_tasks: zun_pre_install.yml tags: - zun-install @@ -81,7 +82,8 @@ tags: - zun-install -- include_role: +- name: Including osa.mq_setup role + include_role: name: openstack.osa.mq_setup apply: tags: @@ -105,7 +107,8 @@ tags: - always -- include_role: +- name: Including osa.db_setup role + include_role: name: openstack.osa.db_setup apply: tags: @@ -127,7 +130,8 @@ tags: - always -- include_role: +- name: Including osa.service_setup role + include_role: name: openstack.osa.service_setup apply: tags: @@ -167,13 +171,15 @@ tags: - always -- import_tasks: zun_compute.yml +- name: Importing zun_post_install tasks + import_tasks: zun_compute.yml when: - "zun_services['zun-compute']['group'] in group_names" tags: - zun-compute -- import_tasks: zun_post_install.yml +- name: Importing zun_post_install tasks + import_tasks: zun_post_install.yml tags: - zun-config @@ -196,10 +202,10 @@ systemd_tempd_prefix: openstack systemd_slice_name: "{{ zun_system_slice_name }}" systemd_lock_dir: "{{ zun_lock_dir }}" - 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_zun_services }}" tags: - zun-config diff --git a/tasks/zun_compute.yml b/tasks/zun_compute.yml index 471eaf2..b7b309f 100644 --- a/tasks/zun_compute.yml +++ b/tasks/zun_compute.yml @@ -36,7 +36,7 @@ get_url: url: "{{ item.gpg_uri }}" dest: "/tmp/{{ item.name }}" - mode: 0440 + mode: "0440" with_items: "{{ zun_docker_repo }}" - name: Add Apt signing key on remote server to keyring @@ -314,6 +314,7 @@ file: path: "/var/tmp/zun-docker-cleanup.disabled" state: "{{ zun_docker_prune_images | ternary('absent', 'touch') }}" + mode: "0644" - name: Remove legacy systemd docker override file: diff --git a/tasks/zun_pre_install.yml b/tasks/zun_pre_install.yml index 29baa9b..9ba12d0 100644 --- a/tasks/zun_pre_install.yml +++ b/tasks/zun_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: "{{ zun_system_group_name }}" gid: "{{ zun_system_group_gid | default(omit) }}" diff --git a/vars/debian.yml b/vars/debian.yml index 4ae6dc4..6561ac4 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -18,7 +18,9 @@ _zun_containerd_package_version: "1.6.20-1" zun_docker_repo: - name: "docker-ce" - repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['distribution_release'] | lower }} stable" + repo: >- + deb [arch=amd64] https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }} {{ + ansible_facts['distribution_release'] | lower }} stable gpg_uri: "https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }}/gpg" # Common apt packages