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: Ie1737a7f88d783e39492c704bb6805c89a199553
This commit is contained in:
Dmitriy Rabotyagov 2025-02-12 13:56:02 +01:00
parent 5cdbe69b50
commit aa1503d8ce
17 changed files with 76 additions and 80 deletions

1
.gitignore vendored
View File

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

View File

@ -12,8 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Enable/Disable barbican configurations
nova_barbican_enabled: "{{ (groups['barbican_all'] is defined) and (groups['barbican_all'] | length > 0) }}"
# Enable/Disable blazar configurations
@ -25,7 +23,7 @@ nova_notifications_designate: notifications_designate
# Enable/Disable ceilometer configurations
nova_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (groups['ceilometer_all'] | length > 0) }}"
# Enable/Disable nova versioned notification
nova_versioned_notification_enabled: False
nova_versioned_notification_enabled: false
# Caching
nova_cache_servers: "{{ nova_memcached_servers | default(memcached_servers) }}"
@ -33,7 +31,7 @@ nova_cache_backend: "{{ openstack_cache_backend | default('oslo_cache.memcache_p
nova_cache_backend_map: "{{ openstack_cache_backend_map | default(_nova_cache_backend_map) }}"
## Verbosity Options
debug: False
debug: false
# Set the host which will execute the shade modules
# for the service setup. The host must already have
@ -128,7 +126,7 @@ nova_api_db_connection_recycle_time: "{{ openstack_db_connection_recycle_time |
## DB Cells
nova_cell0_database: "nova_cell0"
nova_cell1_name: "cell1"
nova_cell_force_update: False
nova_cell_force_update: false
## Oslo Messaging
@ -189,23 +187,22 @@ nova_virt_types:
ironic:
nova_compute_driver: ironic.IronicDriver
nova_reserved_host_memory_mb: 0
nova_scheduler_tracks_instance_changes: False
nova_scheduler_tracks_instance_changes: false
kvm:
nova_compute_driver: libvirt.LibvirtDriver
nova_reserved_host_memory_mb: 2048
nova_scheduler_tracks_instance_changes: True
nova_scheduler_tracks_instance_changes: true
qemu:
nova_compute_driver: libvirt.LibvirtDriver
nova_reserved_host_memory_mb: 2048
nova_scheduler_tracks_instance_changes: True
nova_scheduler_tracks_instance_changes: true
nova_cpu_mode: "none"
# If this is not set, then the playbook will try to guess it.
# nova_virt_type: kvm
# Enable Kernel Shared Memory (KSM)
nova_compute_ksm_enabled: False
nova_compute_ksm_enabled: false
# if set, nova_virt_type must be one of these:
nova_supported_virt_types:
@ -258,7 +255,7 @@ nova_spice_html5proxy_base_proto: "{{ openstack_service_publicuri_proto | defaul
nova_spice_html5proxy_base_port: 6082
nova_spice_html5proxy_base_uri: "{{ nova_spice_html5proxy_base_proto }}://{{ external_lb_vip_address }}:{{ nova_spice_html5proxy_base_port }}"
nova_spice_html5proxy_base_url: "{{ nova_spice_html5proxy_base_uri }}/spice_auto.html"
nova_spice_console_agent_enabled: True
nova_spice_console_agent_enabled: true
nova_spicehtml5_git_repo: "{{ spicehtml5_git_repo | default('https://gitlab.freedesktop.org/spice/spice-html5.git') }}"
nova_spicehtml5_git_install_branch: "{{ spicehtml5_git_install_branch | default('master') }}"
@ -282,12 +279,12 @@ nova_serialconsoleproxy_base_url: "{{ nova_serialconsoleproxy_base_uri }}"
nova_serialconsoleproxy_serialconsole_proxyserver_proxyclient_address: "{{ nova_management_address }}"
## Nova metadata
nova_metadata_proxy_enabled: True
nova_metadata_proxy_enabled: true
nova_metadata_bind_address: "{{ openstack_service_bind_address | default('0.0.0.0') }}"
nova_metadata_port: 8775
## Nova compute
nova_nested_virt_enabled: False
nova_nested_virt_enabled: false
# Uwsgi settings
nova_wsgi_processes_max: 16
@ -301,14 +298,14 @@ nova_uwsgi_tls:
# Warning: If nova_libvirt_inject_key or nova_libvirt_inject_password are enabled for Ubuntu compute hosts
# then the kernel will be made readable to nova user (a requirement for libguestfs).
# See Launchpad bugs 1507915 (Nova), 759725 (Ubuntu), and http://libguestfs.org/guestfs-faq.1.html
nova_libvirt_inject_key: False
nova_libvirt_inject_key: false
# inject partition options:
# -2 => disable, -1 => inspect (libguestfs only), 0 => not partitioned, >0 => partition number
nova_libvirt_inject_partition: -2
nova_libvirt_inject_password: False
nova_libvirt_inject_password: false
nova_libvirt_disk_cachemodes: '{{ (nova_libvirt_images_rbd_pool | length > 0) | ternary("network=writeback", "") }}'
nova_libvirt_hw_disk_discard: '{{ (nova_libvirt_images_rbd_pool | length > 0) | ternary("unmap", "ignore") }}'
nova_libvirt_live_migration_inbound_addr: '{{ _nova_my_ip }}'
nova_libvirt_live_migration_inbound_addr: "{{ _nova_my_ip }}"
## Nova console
# Set the console type for the compute host. Presently the only options are ["spice", "novnc", "serialconsole", "disabled"].
@ -391,16 +388,16 @@ nova_nfs_client: []
# Nova Ceph rbd
# Enble and define nova_libvirt_images_rbd_pool to use rbd as nova backend
# nova_libvirt_images_rbd_pool: vms
nova_libvirt_images_rbd_pool: ''
nova_libvirt_images_rbd_pool: ""
nova_ceph_client: "{{ cinder_ceph_client }}"
# Enabled upstream if RBD is in use on cinder backends, which requires that
# ceph be deployed on the nova compute hosts to enable volume backed instances.
nova_cinder_rbd_inuse: False
nova_cinder_rbd_inuse: false
# Enable compute nodes to retrieve images from RBD directly rather then through
# HTTP if images_type is NOT set to RBD. Must be False if nova images stored in RBD.
nova_glance_rbd_inuse: False
nova_glance_rbd_inuse: false
nova_glance_images_rbd_pool: "{{ glance_rbd_store_pool | default('images') }}"
# Used to determine if we need a Ceph client
@ -476,7 +473,7 @@ nova_services:
service_name: nova-api-metadata
init_config_overrides: "{{ nova_api_metadata_init_overrides }}"
start_order: 5
wsgi_app: True
wsgi_app: true
uwsgi_overrides: "{{ nova_api_metadata_uwsgi_ini_overrides }}"
uwsgi_bind_address: "{{ nova_metadata_bind_address }}"
uwsgi_port: "{{ nova_metadata_port }}"
@ -487,7 +484,7 @@ nova_services:
service_name: nova-api-os-compute
init_config_overrides: "{{ {'Install': {'Alias': 'nova-api.service'}} | combine(nova_api_os_compute_init_overrides, recursive=True) }}"
start_order: 4
wsgi_app: True
wsgi_app: true
uwsgi_overrides: "{{ nova_api_os_compute_uwsgi_ini_overrides }}"
uwsgi_bind_address: "{{ nova_service_bind_address }}"
uwsgi_port: "{{ nova_service_port }}"
@ -624,7 +621,7 @@ nova_pki_certs_path: "{{ nova_pki_dir ~ '/certs/certs/' }}"
nova_pki_intermediate_cert_name: "{{ openstack_pki_service_intermediate_cert_name }}"
nova_pki_intermediate_chain_path: >-
{{ nova_pki_dir ~ '/roots/' ~ nova_pki_intermediate_cert_name ~ '/certs/' ~ nova_pki_intermediate_cert_name ~ '-chain.crt' }}
nova_pki_regen_cert: ''
nova_pki_regen_cert: ""
nova_pki_san: "{{ openstack_pki_san | default('DNS:' ~ ansible_facts['hostname'] ~ ',IP:' ~ management_address) }}"
nova_pki_compute_san: >-
{{
@ -816,7 +813,7 @@ nova_pki_certificates_condition: >-
}}
nova_pki_certificates:
# Used to encrypt traffic between haproxy and nova backends
# Used to encrypt traffic between haproxy and nova backends
- name: "nova_{{ ansible_facts['hostname'] }}_api"
provider: ownca
cn: "{{ ansible_facts['hostname'] }}"
@ -844,7 +841,7 @@ nova_pki_install_certificates:
condition: "{{ nova_pki_certificates_condition | bool }}"
# Periodically move records for deleted resources to shadow tables
nova_archive_deleted: False
nova_archive_deleted: false
# When to start archive task. Reffer to Systemd Calendar Events for guidance
# on format:
# https://www.freedesktop.org/software/systemd/man/systemd.time.html#Calendar%20Events
@ -853,14 +850,14 @@ nova_archive_deleted_on_calendar: "*-*-* 00:00:00"
# Should be in a format of bash date string
nova_archive_deleted_before: "6 month ago"
# Delete records instead of moving them to shadow tables
nova_archive_deleted_purge: False
nova_archive_deleted_purge: false
# Archive instance task log
nova_archive_task_log: False
nova_archive_task_log: false
# Delay the timer by a randomly selected amount of time.
nova_archive_deleted_randomized_delay_sec: 0
# Periodically purge shadow tables, where archived records are stored
nova_purge_deleted: False
nova_purge_deleted: false
# When to start purge task.
nova_purge_deleted_on_calendar: "*-*-* 01:00:00"
# Purge events that are older then the timeframe below.

View File

@ -16,7 +16,7 @@
- name: Stop libvirt-bin
service:
name: "{{ item }}"
enabled: yes
enabled: true
state: "stopped"
listen:
- Restart libvirt-bin
@ -32,7 +32,7 @@
name: "{{ item.name | default(item) }}"
state: "{{ item.condition | default(False) | ternary('started', 'stopped') }}"
enabled: "{{ item.condition | default(False) }}"
masked: no
masked: false
with_items:
- name: libvirtd-tls.socket
condition: "{{ nova_libvirtd_listen_tls | bool }}"
@ -44,7 +44,7 @@
- name: Start libvirt-bin
service:
name: "{{ item }}"
enabled: yes
enabled: true
state: "started"
with_items:
- "{{ libvirt_service_name }}"
@ -82,9 +82,9 @@
- name: Stop services
service:
name: "{{ item.service_name }}"
enabled: yes
enabled: true
state: "stopped"
daemon_reload: yes
daemon_reload: true
with_items: "{{ filtered_nova_services }}"
register: _stop
until: _stop is success
@ -99,9 +99,9 @@
- name: Start services
service:
name: "{{ item.service_name }}"
enabled: yes
enabled: true
state: "started"
daemon_reload: yes
daemon_reload: true
with_items: "{{ filtered_nova_services }}"
register: _start
until: _start is success

View File

@ -46,8 +46,8 @@
clone: "yes"
update: "yes"
version: "{{ nova_novncproxy_git_install_branch }}"
force: yes
accept_hostkey: yes
force: true
accept_hostkey: true
register: git_clone
until: git_clone is success
retries: 5

View File

@ -46,8 +46,8 @@
clone: "yes"
update: "yes"
version: "{{ nova_spicehtml5_git_install_branch }}"
force: yes
accept_hostkey: yes
force: true
accept_hostkey: true
register: git_clone
until: git_clone is success
retries: 5

View File

@ -120,13 +120,12 @@
- nova-kvm
- nova-libvirt
- name: Set qemu-kvm KSM config (Ubuntu)
lineinfile:
dest: "/etc/default/qemu-kvm"
line: "KSM_ENABLED={{ nova_compute_ksm_enabled | ternary('1', '0') }}"
regexp: "^KSM_ENABLED=*"
backup: yes
backup: true
when:
- ansible_facts['distribution'] == 'Ubuntu'
notify: Restart libvirt-bin

View File

@ -29,7 +29,7 @@
register: _qemu_save_dir
- name: Check if the qemu save directory is empty
command: 'ls -1A /var/lib/libvirt/qemu/save'
command: "ls -1A /var/lib/libvirt/qemu/save"
changed_when: false
register: _qemu_save_dir_contents
when:

View File

@ -36,5 +36,5 @@
- name: Enable systemd service which disables smt
service:
name: smt
enabled: yes
enabled: true
when: smt_disable_service | changed

View File

@ -2,13 +2,13 @@
- name: Enable ksm systemd service
service:
name: ksm
enabled: yes
enabled: true
state: started
- name: Enable ksmtuned systemd service
service:
name: ksmtuned
enabled: yes
enabled: true
state: started
when:
- ansible_facts['pkg_mgr'] in ['dnf', 'apt']

View File

@ -13,8 +13,8 @@
- name: Find installed kernels
find:
paths: '/boot'
patterns: 'vmlinuz-*'
paths: "/boot"
patterns: "vmlinuz-*"
register: kernels
- name: Determine latest installed kernel
@ -22,7 +22,7 @@
latest_kernel: "{{ kernels.files | map(attribute='path') | sort(reverse=True) | first }}"
- name: Latest kernel readable to nova group/user
command: 'dpkg-statoverride --update --add root nova 0640 {{ latest_kernel }}'
command: "dpkg-statoverride --update --add root nova 0640 {{ latest_kernel }}"
register: dpkg_statoverride_result
changed_when:
- ("an override for '" ~ latest_kernel ~ "' already exists; aborting" not in dpkg_statoverride_result.stderr)
@ -33,6 +33,6 @@
- name: Script installed to make future kernels readable to nova group/user
copy:
src: 'nova_kernel_permissions'
dest: '/etc/kernel/postinst.d/nova_kernel_permissions'
mode: '0755'
src: "nova_kernel_permissions"
dest: "/etc/kernel/postinst.d/nova_kernel_permissions"
mode: "0755"

View File

@ -68,7 +68,7 @@
- rpcbind.service rpc-statd.service
Before:
- nova-compute.service
state: 'started'
state: "started"
enabled: true
with_items: "{{ nova_nfs_client }}"
loop_control:

View File

@ -23,11 +23,10 @@
command: >-
{{ _db_nova_bin }}/nova-manage --config-file {{ nova_conf_version_dir }}/nova.conf cell_v2 discover_hosts{{ (debug | bool) | ternary(' --verbose', '') }}{{
(nova_ironic_used | bool) | ternary(' --by-service', '') }}
become: yes
become: true
become_user: "{{ _db_nova_system_user_name }}"
changed_when: false
# If it exits with partial updates (exit status 1) it should be called again,
# even if some updates initially generated errors,
# because some updates may depend on others having completed. If it exits with status 2,
@ -35,7 +34,7 @@
# It should be considered successfully completed only when the exit status is 0.
- name: Perform online data migrations
command: "{{ _db_nova_bin }}/nova-manage --config-file {{ nova_conf_version_dir }}/nova.conf db online_data_migrations"
become: yes
become: true
become_user: "{{ _db_nova_system_user_name }}"
changed_when: false
when:
@ -51,7 +50,7 @@
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
section: nova
option: need_online_data_migrations
value: False
value: false
mode: "0644"
with_items: "{{ groups[nova_services['nova-conductor']['group']] }}"
when:
@ -73,10 +72,10 @@
execstarts:
- /bin/sh -c "{{ _db_nova_bin }}/nova-manage db archive_deleted_rows --until-complete --all-cells --before \"$(date -d '{{ nova_archive_deleted_before }}' +'%%Y-%%m-%%d %%H:%%M')\" {{ (nova_archive_deleted_purge) | ternary('--purge', '') }} {{ (nova_archive_task_log) | ternary('--task-log', '') }}" # noqa: yaml[line-length]
environment:
UMASK: '0640'
UMASK_DIR: '0750'
UMASK: "0640"
UMASK_DIR: "0750"
program_sandboxing:
RuntimeDirectory: 'nova-archive-deleted'
RuntimeDirectory: "nova-archive-deleted"
enabled: "{{ nova_archive_deleted }}"
timer:
state: "{{ nova_archive_deleted | ternary('started', 'stopped') }}"
@ -90,10 +89,10 @@
execstarts:
- /bin/sh -c "{{ _db_nova_bin }}/nova-manage db purge --all-cells --before \"$(date -d '{{ nova_purge_deleted_before }}' +'%%Y-%%m-%%d %%H:%%M')\"" # noqa: yaml[line-length]
environment:
UMASK: '0640'
UMASK_DIR: '0750'
UMASK: "0640"
UMASK_DIR: "0750"
program_sandboxing:
RuntimeDirectory: 'nova-purge-deleted'
RuntimeDirectory: "nova-purge-deleted"
enabled: "{{ nova_purge_deleted }}"
timer:
state: "{{ nova_purge_deleted | ternary('started', 'stopped') }}"

View File

@ -15,7 +15,7 @@
- name: Synchronize the nova API DB schema
command: "{{ nova_bin }}/nova-manage --config-file {{ nova_conf_version_dir }}/nova.conf api_db sync"
become: yes
become: true
become_user: "{{ nova_system_user_name }}"
changed_when: false
@ -23,7 +23,7 @@
# might be not idempotent due to the bug https://bugs.launchpad.net/nova/+bug/1923899
- name: Get UUID of Nova Cells
command: "{{ nova_bin }}/nova-manage --config-file {{ nova_conf_version_dir }}/nova.conf cell_v2 list_cells"
become: yes
become: true
become_user: "{{ nova_system_user_name }}"
changed_when: false
register: _cell_list
@ -43,7 +43,7 @@
--database_connection mysql+pymysql://{{ nova_api_galera_user }}:{{ nova_api_container_mysql_password }}@{{ nova_api_galera_address }}/{{
nova_cell0_database }}?charset=utf8{% if nova_galera_use_ssl | bool %}&ssl_verify_cert=true{%
if nova_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ nova_galera_ssl_ca_cert }}{% endif %}{% endif %}
become: yes
become: true
become_user: "{{ nova_system_user_name }}"
changed_when: false
when:
@ -56,7 +56,7 @@
nova_cell0_database }}?charset=utf8{% if nova_galera_use_ssl | bool %}&ssl_verify_cert=true{%
if nova_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ nova_galera_ssl_ca_cert }}{% endif %}{% endif %}
--transport-url 'none:/'
become: yes
become: true
become_user: "{{ nova_system_user_name }}"
changed_when: false
when:
@ -67,7 +67,7 @@
- name: Synchronize the nova DB schema
command: "{{ nova_bin }}/nova-manage --config-file {{ nova_conf_version_dir }}/nova.conf db sync"
become: yes
become: true
become_user: "{{ nova_system_user_name }}"
changed_when: false
@ -78,7 +78,7 @@
--database_connection {scheme}://{username}:{password}@{hostname}:{port}/{path}?{query}
--transport-url {scheme}://{username}:{password}@{hostname}:{port}/{{ (
not nova_oslomsg_rabbit_quorum_queues | bool) | ternary('/{path}', '{path}') }}?{query}
become: yes
become: true
become_user: "{{ nova_system_user_name }}"
register: nova_cell1_create
# When upgrading, cell1 will already exist and nova-manage will
@ -101,7 +101,7 @@
--database_connection {scheme}://{username}:{password}@{hostname}:{port}/{path}?{query}
--transport-url {scheme}://{username}:{password}@{hostname}:{port}/{{ (
not nova_oslomsg_rabbit_quorum_queues | bool) | ternary('/{path}', '{path}') }}?{query}
become: yes
become: true
become_user: "{{ nova_system_user_name }}"
changed_when: false
when:
@ -116,7 +116,7 @@
# https://docs.openstack.org/nova/latest/cli/nova-status.html
- name: Run nova-status upgrade check to validate a healthy configuration
command: "{{ nova_bin }}/nova-status --config-file {{ nova_conf_version_dir }}/nova.conf upgrade check"
become: yes
become: true
become_user: "{{ nova_system_user_name }}"
register: nova_status_upgrade_check
until: nova_status_upgrade_check is success

View File

@ -125,7 +125,7 @@
- name: Disable existing services for any unused console types
systemd:
name: "{{ item.service }}"
enabled: no
enabled: false
state: stopped
when: (item.condition | bool) and item.type not in nova_console_proxy_types
loop:

View File

@ -75,7 +75,7 @@
dest: "{{ nova_conf_version_dir }}/vendor_data.json"
config_overrides: "{{ nova_vendor_data_overrides }}"
config_type: "json"
yml_multilines: True
yml_multilines: true
notify:
- Restart nova services
- Restart uwsgi services
@ -136,7 +136,7 @@
fetch:
src: "{{ item.target_f }}"
dest: "{{ item.tmp_f }}"
flat: yes
flat: true
changed_when: false
run_once: true
with_items: "{{ nova_core_files }}"

View File

@ -49,4 +49,4 @@ nova_package_list: |-
{% set _ = packages.extend(nova_service_distro_packages) %}
{{ packages }}
_nova_bin: '/usr/bin'
_nova_bin: "/usr/bin"

View File

@ -171,10 +171,10 @@ _nova_cache_backend_map:
- oslo_cache.etcd3gw
_nova_cache_backend_package: |-
{% set oslo = namespace(backend='dogpile') %}
{% for key, value in _nova_cache_backend_map.items() %}
{% if nova_cache_backend in value %}
{% set oslo.backend = key %}
{%- endif %}
{%- endfor %}
oslo.cache[{{ oslo.backend }}]
{% set oslo = namespace(backend='dogpile') %}
{% for key, value in _nova_cache_backend_map.items() %}
{% if nova_cache_backend in value %}
{% set oslo.backend = key %}
{%- endif %}
{%- endfor %}
oslo.cache[{{ oslo.backend }}]