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/openstack-ansible/+/891474
Change-Id: I315c7fa58ee07786832d21c13f281968ee3d400a
This commit is contained in:
Dmitriy Rabotyagov 2023-07-14 19:24:59 +02:00 committed by Dmitriy Rabotyagov
parent 30b4098fd2
commit 87ca7b41e3
8 changed files with 54 additions and 30 deletions

View File

@ -24,11 +24,16 @@ placement_package_state: "{{ package_state | default('latest') }}"
# for the service setup. The host must already have
# clouds.yaml properly configured.
placement_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}"
placement_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((placement_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
placement_service_setup_host_python_interpreter: >-
{{
openstack_service_setup_host_python_interpreter | default(
(placement_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable']))
}}
placement_git_repo: https://opendev.org/openstack/placement
placement_git_install_branch: master
placement_upper_constraints_url: "{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}"
placement_upper_constraints_url: >-
{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}
placement_git_constraints:
- "--constraint {{ placement_upper_constraints_url }}"
@ -40,7 +45,11 @@ placement_bin: "{{ _placement_bin }}"
## Database info
placement_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
placement_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((placement_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
placement_db_setup_python_interpreter: >-
{{
openstack_db_setup_python_interpreter | default(
(placement_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable']))
}}
placement_galera_address: "{{ galera_address | default('127.0.0.1') }}"
placement_galera_database: placement
placement_galera_user: placement
@ -65,7 +74,8 @@ placement_service_port: 8780
# UWSGI
placement_wsgi_processes_max: 16
placement_wsgi_processes: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, placement_wsgi_processes_max] | min }}"
placement_wsgi_processes: >-
{{ [[(ansible_facts['processor_vcpus'] // ansible_facts['processor_threads_per_core']) | default(1), 1] | max * 2, placement_wsgi_processes_max] | min }}
placement_wsgi_threads: 1
placement_uwsgi_tls:
crt: "{{ placement_ssl_cert }}"
@ -183,5 +193,5 @@ placement_pki_install_certificates:
mode: "0600"
# Define user-provided SSL certificates
#placement_user_ssl_cert: <path to cert on ansible deployment host>
#placement_user_ssl_key: <path to cert on ansible deployment host>
# placement_user_ssl_cert: <path to cert on ansible deployment host>
# placement_user_ssl_key: <path to cert on ansible deployment host>

View File

@ -18,19 +18,21 @@ galaxy_info:
description: Installation and setup of placement
company: Vexxhost
license: Apache2
min_ansible_version: 2.4
role_name: os_placement
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
- placement

View File

@ -43,7 +43,8 @@
tags:
- always
- include_role:
- name: Including osa.db_setup role
include_role:
name: openstack.osa.db_setup
apply:
tags:
@ -64,11 +65,13 @@
tags:
- always
- import_tasks: placement_pre_install.yml
- name: Importing placement_pre_install tasks
import_tasks: placement_pre_install.yml
tags:
- placement-install
- import_tasks: placement_install.yml
- name: Importing placement_install tasks
import_tasks: placement_install.yml
tags:
- placement-install
@ -92,11 +95,13 @@
tags:
- always
- import_tasks: placement_post_install.yml
- name: Importing placement_post_install tasks
import_tasks: placement_post_install.yml
tags:
- placement-config
- import_tasks: placement_db_sync.yml
- name: Importing placement_db_sync tasks
import_tasks: placement_db_sync.yml
when: _placement_is_first_play_host
tags:
- placement-config
@ -111,7 +116,8 @@
- placement-config
- uwsgi
- include_role:
- name: Including osa.service_setup role
include_role:
name: openstack.osa.service_setup
apply:
tags:

View File

@ -19,6 +19,7 @@
section: "placement"
option: "install_method"
value: "{{ placement_install_method }}"
mode: "0644"
- name: Refresh local facts to ensure the placement section is present
setup:
@ -62,6 +63,7 @@
section: "placement"
option: "need_service_restart"
value: true
mode: "0644"
when: (install_packages is changed) or
('need_service_restart' not in ansible_local['openstack_ansible']['placement'])
@ -74,10 +76,10 @@
systemd_tempd_prefix: openstack
systemd_slice_name: placement
systemd_lock_path: /var/lock/placement
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:
- service_name: "{{ service_var.service_name }}"
enabled: yes

View File

@ -18,7 +18,7 @@
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "root"
group: "{{ item.group|default(placement_system_group_name) }}"
group: "{{ item.group | default(placement_system_group_name) }}"
mode: "0640"
config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}"

View File

@ -13,17 +13,17 @@
# 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: "{{ placement_system_group_name }}"
gid: "{{ placement_system_group_gid|default(omit) }}"
gid: "{{ placement_system_group_gid | default(omit) }}"
state: "present"
system: "yes"
- name: Create the placement system user
user:
name: "{{ placement_system_user_name }}"
uid: "{{ placement_system_user_uid|default(omit) }}"
uid: "{{ placement_system_user_uid | default(omit) }}"
group: "{{ placement_system_group_name }}"
comment: "{{ placement_system_comment }}"
shell: "{{ placement_system_shell }}"
@ -35,9 +35,9 @@
file:
path: "{{ item.path }}"
state: directory
owner: "{{ item.owner|default(placement_system_user_name) }}"
group: "{{ item.group|default(placement_system_group_name) }}"
mode: "{{ item.mode|default('0755') }}"
owner: "{{ item.owner | default(placement_system_user_name) }}"
group: "{{ item.group | default(placement_system_group_name) }}"
mode: "{{ item.mode | default('0755') }}"
with_items:
- path: "/openstack"
mode: "0755"

View File

@ -14,7 +14,7 @@
# limitations under the License.
placement_package_list: |-
{% set packages = (placement_distro_packages + placement_service_distro_packages) %}
{% set packages = placement_distro_packages + placement_service_distro_packages %}
{{ packages }}
_placement_bin: "/usr/bin"

View File

@ -13,7 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
_placement_is_first_play_host: "{{ (placement_services['placement-api']['group'] in group_names and inventory_hostname == (groups[placement_services['placement-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }}"
_placement_is_first_play_host: >-
{{
(placement_services['placement-api']['group'] in group_names and
inventory_hostname == (groups[placement_services['placement-api']['group']] | intersect(ansible_play_hosts)) | first) | bool
}}
# Compile a list of the services on a host based on whether
# the host is in the host group and the service is enabled.