Auto-fix yaml rules

In order to reduce divergance with ansible-lint rules, we apply
auto-fixing of violations.

In current patch we replace all kind of truthy variables with
`true` or `false` values to align with recommendations along with
alignment of used quotes.

Change-Id: I2773d3465665bfe95516ca8f34fc8351b1e8c18f
This commit is contained in:
Dmitriy Rabotyagov 2025-02-13 09:57:12 +01:00
parent 018139f0cd
commit 3fa0c33ed3
20 changed files with 83 additions and 86 deletions

1
.gitignore vendored
View File

@ -45,6 +45,7 @@ logs/*
# OS generated files # # OS generated files #
###################### ######################
._* ._*
.ansible
.tox .tox
*.egg-info *.egg-info
.eggs .eggs

View File

@ -40,9 +40,11 @@ ceph_client_package_state: "{{ package_state | default('latest') }}"
# package repositories. # package repositories.
ceph_pkg_source: ceph ceph_pkg_source: ceph
ceph_stable_release: reef ceph_stable_release: reef
ceph_apt_pinned_packages: [{package: "*", release: "ceph.com", priority: 1001}] ceph_apt_pinned_packages:
- package: "*"
ceph_repo_url_region: "download" # see here for other mirros http://docs.ceph.com/docs/master/install/mirrors/ release: "ceph.com"
priority: 1001
ceph_repo_url_region: "download" # see here for other mirros http://docs.ceph.com/docs/master/install/mirrors/
ceph_repo_url: https://{{ ceph_repo_url_region }}.ceph.com/{{ _ceph_repo_distro_suffix }}-{{ ceph_stable_release }} ceph_repo_url: https://{{ ceph_repo_url_region }}.ceph.com/{{ _ceph_repo_distro_suffix }}-{{ ceph_stable_release }}
ceph_repos: "{{ _ceph_repos }}" ceph_repos: "{{ _ceph_repos }}"
@ -99,14 +101,14 @@ immutable_object_cache_client: immutable-object-cache
# needs to access both volumes (cinder) as boot disks (nova) we default to # needs to access both volumes (cinder) as boot disks (nova) we default to
# reuse the cinder_ceph_client # reuse the cinder_ceph_client
# only need to change this if you'd use ceph for boot disks and not for volumes # only need to change this if you'd use ceph for boot disks and not for volumes
nova_ceph_client: '{{ cinder_ceph_client }}' nova_ceph_client: "{{ cinder_ceph_client }}"
# overruled in user_secrets: # overruled in user_secrets:
# nova_ceph_client_uuid: # nova_ceph_client_uuid:
cephkeys_access_group: ceph cephkeys_access_group: ceph
openstack_service_system_user: null openstack_service_system_user:
ceph_cinder_service_names: ceph_cinder_service_names:
- cinder-volume - cinder-volume
@ -141,7 +143,7 @@ ceph_centos_epel_key: >-
{{ centos_epel_key | default('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-' ~ ansible_facts['distribution_major_version']) }} {{ centos_epel_key | default('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-' ~ ansible_facts['distribution_major_version']) }}
# Immutible object cache - caches a read-only base layer of rbd volumes # Immutible object cache - caches a read-only base layer of rbd volumes
ceph_immutable_object_cache_enabled: False ceph_immutable_object_cache_enabled: false
ceph_immutable_object_cache_service_name: "ceph-immutable-object-cache@" ceph_immutable_object_cache_service_name: "ceph-immutable-object-cache@"
ceph_immutable_object_cache_dir: "/ceph-immutable-object-cache" ceph_immutable_object_cache_dir: "/ceph-immutable-object-cache"
ceph_immutable_object_cache_socket: "/run/ceph/immutable_object_cache_sock" ceph_immutable_object_cache_socket: "/run/ceph/immutable_object_cache_sock"
@ -152,7 +154,7 @@ ceph_immutable_object_cache_mode: "0775"
ceph_immutable_object_cache_key_owner: "{{ ceph_immutable_object_cache_owner }}" ceph_immutable_object_cache_key_owner: "{{ ceph_immutable_object_cache_owner }}"
ceph_immutable_object_cache_key_group: "{{ ceph_immutable_object_cache_group }}" ceph_immutable_object_cache_key_group: "{{ ceph_immutable_object_cache_group }}"
ceph_persistent_write_log_cache_enabled: False ceph_persistent_write_log_cache_enabled: false
ceph_persistent_write_log_cache_dir: "/rbd-write-log-cache" ceph_persistent_write_log_cache_dir: "/rbd-write-log-cache"
ceph_persistent_write_log_cache_owner: "libvirt-qemu" ceph_persistent_write_log_cache_owner: "libvirt-qemu"
ceph_persistent_write_log_cache_group: "ceph" ceph_persistent_write_log_cache_group: "ceph"

View File

@ -1,3 +1,4 @@
---
- name: Install Ceph client - name: Install Ceph client
hosts: all hosts: all
user: root user: root

View File

@ -1,3 +1,4 @@
---
# Copyright 2014, Rackspace US, Inc. # Copyright 2014, Rackspace US, Inc.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -29,7 +29,7 @@
user: user:
name: "{{ openstack_service_system_user }}" name: "{{ openstack_service_system_user }}"
groups: "{{ cephkeys_access_group }}" groups: "{{ cephkeys_access_group }}"
append: yes append: true
notify: notify:
- Restart os services - Restart os services
@ -111,7 +111,7 @@
- name: Detect correct group for extra auth - name: Detect correct group for extra auth
set_fact: set_fact:
ceph_in_extra_auth_group: True ceph_in_extra_auth_group: true
with_items: "{{ ceph_extra_auth_groups }}" with_items: "{{ ceph_extra_auth_groups }}"
when: when:
- ceph_extra_confs is defined - ceph_extra_confs is defined
@ -125,7 +125,7 @@
- name: Detect extra nova uuid secret - name: Detect extra nova uuid secret
set_fact: set_fact:
ceph_extra_nova_uuid: True ceph_extra_nova_uuid: true
with_items: "{{ ceph_extra_confs | default([]) }}" with_items: "{{ ceph_extra_confs | default([]) }}"
when: when:
- inventory_hostname in groups[ceph_extra_compute_group] - inventory_hostname in groups[ceph_extra_compute_group]

View File

@ -12,8 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Create keyring files for openstack clients from extra cluster(s) - name: Create keyring files for openstack clients from extra cluster(s)
shell: >- shell: >-
ceph auth get client.{{ item.client_name }} --cluster {{ ceph_cluster_name }} >/dev/null && ceph auth get client.{{ item.client_name }} --cluster {{ ceph_cluster_name }} >/dev/null &&

View File

@ -12,8 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Create key files for nova_compute on extra cluster(s) - name: Create key files for nova_compute on extra cluster(s)
shell: >- shell: >-
ceph auth get-key client.{{ item.client_name }} --cluster {{ ceph_cluster_name }} ceph auth get-key client.{{ item.client_name }} --cluster {{ ceph_cluster_name }}

View File

@ -25,7 +25,7 @@
slurp: slurp:
src: "/etc/ceph/{{ ceph_cluster_name }}.conf" src: "/etc/ceph/{{ ceph_cluster_name }}.conf"
register: ceph_conf_content_mon register: ceph_conf_content_mon
delegate_to: '{{ ceph_mon_host }}' delegate_to: "{{ ceph_mon_host }}"
changed_when: false changed_when: false
when: when:
- ceph_conf_file is not defined - ceph_conf_file is not defined
@ -44,19 +44,19 @@
- name: Create ceph.conf from mon host - name: Create ceph.conf from mon host
openstack.config_template.config_template: openstack.config_template.config_template:
content: '{{ ceph_conf }}' content: "{{ ceph_conf }}"
dest: "/etc/ceph/{{ ceph_cluster_name }}.conf" dest: "/etc/ceph/{{ ceph_cluster_name }}.conf"
owner: root owner: root
group: root group: root
mode: "0644" mode: "0644"
config_type: ini config_type: ini
config_overrides: '{{ ceph_client_ceph_conf_overrides }}' config_overrides: "{{ ceph_client_ceph_conf_overrides }}"
notify: notify:
- Restart os services - Restart os services
- name: Detect correct group for extra config - name: Detect correct group for extra config
set_fact: set_fact:
ceph_in_extra_config_group: True ceph_in_extra_config_group: true
when: when:
- ceph_extra_confs is defined - ceph_extra_confs is defined
- inventory_hostname in groups[item] - inventory_hostname in groups[item]

View File

@ -12,8 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Get extra ceph.conf files - name: Get extra ceph.conf files
command: "scp {{ item.mon_host }}:/etc/ceph/{{ item.cluster_name | default(ceph_cluster_name) }}.conf {{ item.src }}" command: "scp {{ item.mon_host }}:/etc/ceph/{{ item.cluster_name | default(ceph_cluster_name) }}.conf {{ item.src }}"
changed_when: false changed_when: false

View File

@ -27,7 +27,7 @@
{% endfor %} {% endfor %}
{{ _keys }} {{ _keys }}
changed_when: false changed_when: false
delegate_facts: False delegate_facts: false
delegate_to: localhost delegate_to: localhost
tags: tags:
- ceph-config - ceph-config

View File

@ -25,7 +25,7 @@
ceph auth get-or-create client.{{ item['name'] }} --cluster {{ ceph_cluster_name }} ceph auth get-or-create client.{{ item['name'] }} --cluster {{ ceph_cluster_name }}
with_items: "{{ ceph_client_filtered_clients }}" with_items: "{{ ceph_client_filtered_clients }}"
changed_when: false changed_when: false
delegate_to: '{{ ceph_mon_host }}' delegate_to: "{{ ceph_mon_host }}"
register: ceph_client_keyrings register: ceph_client_keyrings
until: ceph_client_keyrings is success until: ceph_client_keyrings is success
retries: 3 retries: 3
@ -63,7 +63,7 @@
- inventory_hostname in groups.nova_compute - inventory_hostname in groups.nova_compute
- nova_ceph_client in ceph_client_filtered_clients | map(attribute='name') | list - nova_ceph_client in ceph_client_filtered_clients | map(attribute='name') | list
changed_when: false changed_when: false
delegate_to: '{{ ceph_mon_host }}' delegate_to: "{{ ceph_mon_host }}"
register: ceph_nova_secret register: ceph_nova_secret
tags: tags:
- always - always

View File

@ -26,7 +26,7 @@
- name: Set ceph_mon_host to an online monitor host - name: Set ceph_mon_host to an online monitor host
set_fact: set_fact:
ceph_mon_host: '{{ item.item }}' ceph_mon_host: "{{ item.item }}"
when: when:
- item is success - item is success
# Use the first available monitor # Use the first available monitor

View File

@ -1,3 +1,4 @@
---
# Copyright 2023, BBC R&D # Copyright 2023, BBC R&D
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -15,7 +15,7 @@
- name: Install ceph packages - name: Install ceph packages
package: package:
name: '{{ ceph_client_filtered_packages }}' name: "{{ ceph_client_filtered_packages }}"
state: "{{ ceph_client_package_state }}" state: "{{ ceph_client_package_state }}"
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}" update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(cache_timeout, omit) }}" cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(cache_timeout, omit) }}"

View File

@ -18,7 +18,7 @@
paths: "{{ openstack_service_venv_bin | dirname }}/lib/" paths: "{{ openstack_service_venv_bin | dirname }}/lib/"
patterns: "python*" patterns: "python*"
file_type: directory file_type: directory
recurse: no recurse: false
register: python_venv_details register: python_venv_details
- name: Set python venvs details - name: Set python venvs details

View File

@ -77,7 +77,7 @@
- name: Update Apt cache - name: Update Apt cache
apt: apt:
update_cache: yes update_cache: true
when: (apt_repo_removed is changed) or (deb822_repos is changed) when: (apt_repo_removed is changed) or (deb822_repos is changed)
register: update_apt_cache register: update_apt_cache
until: update_apt_cache is success until: update_apt_cache is success

View File

@ -113,13 +113,13 @@
- name: Write AppArmor configuration for ceph immutable object caching - name: Write AppArmor configuration for ceph immutable object caching
ansible.builtin.blockinfile: ansible.builtin.blockinfile:
create: True create: true
mode: "0644" mode: "0644"
path: /etc/apparmor.d/local/abstractions/libvirt-qemu path: /etc/apparmor.d/local/abstractions/libvirt-qemu
marker: "### {mark} OSA CEPH_CLIENT IMMUTABLE OBJECT CACHE BLOCK ###" marker: "### {mark} OSA CEPH_CLIENT IMMUTABLE OBJECT CACHE BLOCK ###"
block: | block: |
{{ ceph_immutable_object_cache_dir }}/** r, {{ ceph_immutable_object_cache_dir }}/** r,
{{ ceph_immutable_object_cache_socket }} rw, {{ ceph_immutable_object_cache_socket }} rw,
state: "{{ ceph_immutable_object_cache_enabled | bool | ternary('present', 'absent') }}" state: "{{ ceph_immutable_object_cache_enabled | bool | ternary('present', 'absent') }}"
when: when:
- ansible_facts['os_family'] == "Debian" - ansible_facts['os_family'] == "Debian"
@ -139,12 +139,12 @@
- name: Write AppArmor configuration for ceph write log caching - name: Write AppArmor configuration for ceph write log caching
ansible.builtin.blockinfile: ansible.builtin.blockinfile:
create: True create: true
mode: "0644" mode: "0644"
path: /etc/apparmor.d/local/abstractions/libvirt-qemu path: /etc/apparmor.d/local/abstractions/libvirt-qemu
marker: "### {mark} OSA CEPH_CLIENT WRITE LOG CACHE BLOCK ###" marker: "### {mark} OSA CEPH_CLIENT WRITE LOG CACHE BLOCK ###"
block: | block: |
{{ ceph_persistent_write_log_cache_dir }}/** rwk, {{ ceph_persistent_write_log_cache_dir }}/** rwk,
state: "{{ ceph_persistent_write_log_cache_enabled | bool | ternary('present', 'absent') }}" state: "{{ ceph_persistent_write_log_cache_enabled | bool | ternary('present', 'absent') }}"
when: when:
- ansible_facts['os_family'] == "Debian" - ansible_facts['os_family'] == "Debian"

View File

@ -17,7 +17,6 @@
## APT Cache Options ## APT Cache Options
cache_timeout: 600 cache_timeout: 600
libvirt_packages: libvirt_packages:
- libvirt-daemon-system - libvirt-daemon-system

View File

@ -12,26 +12,24 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# http://ceph.com/docs/master/rbd/rbd-openstack/ # http://ceph.com/docs/master/rbd/rbd-openstack/
ceph_components: ceph_components:
- component: glance_api - component: glance_api
package: "{{ python_ceph_packages }}" package: "{{ python_ceph_packages }}"
client: client:
- name: '{{ glance_ceph_client }}' - name: "{{ glance_ceph_client }}"
service: '{{ ceph_glance_service_names }}' service: "{{ ceph_glance_service_names }}"
- component: cinder_volume - component: cinder_volume
package: "{{ ['ceph-common'] + python_ceph_packages }}" package: "{{ ['ceph-common'] + python_ceph_packages }}"
client: client:
- name: '{{ cinder_ceph_client }}' - name: "{{ cinder_ceph_client }}"
service: '{{ ceph_cinder_service_names }}' service: "{{ ceph_cinder_service_names }}"
- component: cinder_backup - component: cinder_backup
package: "{{ ['ceph-common'] + python_ceph_packages }}" package: "{{ ['ceph-common'] + python_ceph_packages }}"
client: client:
- name: '{{ cinder_backup_ceph_client }}' - name: "{{ cinder_backup_ceph_client }}"
service: '{{ ceph_cinder_service_names }}' service: "{{ ceph_cinder_service_names }}"
- component: nova_compute - component: nova_compute
package: "{{ (libvirt_packages + ['ceph-common'] + ceph_immutable_object_cache_packages + python_ceph_packages) | select }}" package: "{{ (libvirt_packages + ['ceph-common'] + ceph_immutable_object_cache_packages + python_ceph_packages) | select }}"
client: client:
@ -40,7 +38,7 @@ ceph_components:
owner: "{{ ceph_immutable_object_cache_key_owner }}" owner: "{{ ceph_immutable_object_cache_key_owner }}"
group: "{{ ceph_immutable_object_cache_key_group }}" group: "{{ ceph_immutable_object_cache_key_group }}"
enabled: "{{ ceph_immutable_object_cache_enabled }}" enabled: "{{ ceph_immutable_object_cache_enabled }}"
service: '{{ ceph_nova_service_names }}' service: "{{ ceph_nova_service_names }}"
- component: manila_share - component: manila_share
package: "{{ ['ceph-common'] + python_ceph_packages }}" package: "{{ ['ceph-common'] + python_ceph_packages }}"
client: client:
@ -63,44 +61,44 @@ ceph_extra_components: []
# service: '{{ ceph_gnocchi_service_names }}' # service: '{{ ceph_gnocchi_service_names }}'
ceph_client_filtered_packages: |- ceph_client_filtered_packages: |-
{% set packages = [] %} {% set packages = [] %}
{% for comp in (ceph_components + ceph_extra_components) %} {% for comp in (ceph_components + ceph_extra_components) %}
{% if comp.component in group_names %} {% if comp.component in group_names %}
{% for pkg_name in comp.package %} {% for pkg_name in comp.package %}
{% if pkg_name not in packages %} {% if pkg_name not in packages %}
{% set _ = packages.append(pkg_name) %} {% set _ = packages.append(pkg_name) %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{{ packages }} {{ packages }}
ceph_client_filtered_services: |- ceph_client_filtered_services: |-
{% set services = [] %} {% set services = [] %}
{% for comp in (ceph_components + ceph_extra_components) %} {% for comp in (ceph_components + ceph_extra_components) %}
{% if comp.component in group_names and 'service' in comp %} {% if comp.component in group_names and 'service' in comp %}
{% set _ = services.append(comp.service) %} {% set _ = services.append(comp.service) %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{{ services }} {{ services }}
ceph_client_filtered_clients: |- ceph_client_filtered_clients: |-
{% set clients = [] %} {% set clients = [] %}
{% for comp in (ceph_components + ceph_extra_components) %} {% for comp in (ceph_components + ceph_extra_components) %}
{% if comp.component in group_names %} {% if comp.component in group_names %}
{% if ((comp.component != 'cinder_backup') or {% if ((comp.component != 'cinder_backup') or
((cinder_service_backup_program_enabled is defined and ((cinder_service_backup_program_enabled is defined and
cinder_service_backup_program_enabled | bool) and cinder_service_backup_program_enabled | bool) and
(cinder_service_backup_driver is defined and (cinder_service_backup_driver is defined and
'ceph' in cinder_service_backup_driver))) %} 'ceph' in cinder_service_backup_driver))) %}
{% for client in comp.client %} {% for client in comp.client %}
{% if client is not mapping %} {% if client is not mapping %}
{% set _ = clients.append({'name': client}) %} {% set _ = clients.append({'name': client}) %}
{% elif client['enabled'] | default(true) | bool %} {% elif client['enabled'] | default(true) | bool %}
{% set _ = clients.append(client) %} {% set _ = clients.append(client) %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{{ clients }} {{ clients }}

View File

@ -39,9 +39,9 @@ _ceph_repos:
- name: ceph-client-deps - name: ceph-client-deps
baseurl: "{{ ceph_centos_epel_mirror ~ '/' ~ ansible_facts['distribution_major_version'] ~ '/Everything/' ~ ansible_facts['architecture'] }}" baseurl: "{{ ceph_centos_epel_mirror ~ '/' ~ ansible_facts['distribution_major_version'] ~ '/Everything/' ~ ansible_facts['architecture'] }}"
description: "Extra Packages for Enterprise Linux {{ ansible_facts['distribution_major_version'] }} - $basearch" description: "Extra Packages for Enterprise Linux {{ ansible_facts['distribution_major_version'] }} - $basearch"
gpgcheck: yes gpgcheck: true
gpgkey: "file:///etc/pki/rpm-gpg/{{ ceph_centos_epel_key.split('/')[-1] }}" gpgkey: "file:///etc/pki/rpm-gpg/{{ ceph_centos_epel_key.split('/')[-1] }}"
enabled: yes enabled: true
state: "{{ (ceph_pkg_source == 'ceph') | ternary('present', 'absent') }}" state: "{{ (ceph_pkg_source == 'ceph') | ternary('present', 'absent') }}"
includepkgs: includepkgs:
- fmt - fmt
@ -50,7 +50,7 @@ _ceph_repos:
- libarrow-doc - libarrow-doc
- libbabeltrace - libbabeltrace
- liboath - liboath
- 'lttng-ust*' - "lttng-ust*"
- parquet-libs - parquet-libs
- re2 - re2
- thrift - thrift
@ -59,16 +59,16 @@ _ceph_repos:
description: "Ceph packages for $basearch" description: "Ceph packages for $basearch"
file: ceph file: ceph
baseurl: "{{ ceph_repo_url }}/el$releasever/$basearch" baseurl: "{{ ceph_repo_url }}/el$releasever/$basearch"
gpgcheck: yes gpgcheck: true
enabled: yes enabled: true
priority: 50 priority: 50
state: "{{ (ceph_pkg_source == 'ceph') | ternary('present', 'absent') }}" state: "{{ (ceph_pkg_source == 'ceph') | ternary('present', 'absent') }}"
- name: ceph-noarch - name: ceph-noarch
description: "Ceph noarch packages" description: "Ceph noarch packages"
file: ceph file: ceph
baseurl: "{{ ceph_repo_url }}/el$releasever/noarch" baseurl: "{{ ceph_repo_url }}/el$releasever/noarch"
gpgcheck: yes gpgcheck: true
enabled: yes enabled: true
priority: 50 priority: 50
state: "{{ (ceph_pkg_source == 'ceph') | ternary('present', 'absent') }}" state: "{{ (ceph_pkg_source == 'ceph') | ternary('present', 'absent') }}"