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: I5f7e27158a4bf8f4bf14d4a5e32cc9204441da02
This commit is contained in:
Dmitriy Rabotyagov 2025-02-12 08:17:18 +01:00
parent 77995baef7
commit 3add3ee734
13 changed files with 50 additions and 52 deletions

1
.gitignore vendored
View File

@ -48,6 +48,7 @@ logs/*
.tox
*.egg-info
.eggs
.ansible
# Generated by pbr while building docs
######################################

View File

@ -183,11 +183,11 @@ galera_init_overrides: {}
# This is only applied if the ansible_facts['pkg_mgr'] is 'apt'
galera_distro_package_pins:
- package: '*'
- package: "*"
release: MariaDB
priority: 999
- package: 'mariadb-*'
version: '1:{{ galera_major_version }}.{{ galera_minor_version }}*'
- package: "mariadb-*"
version: "1:{{ galera_major_version }}.{{ galera_minor_version }}*"
priority: 1001
# Galera Server SSL functionality.
@ -197,7 +197,7 @@ galera_pki_dir: "{{ openstack_pki_dir | default('/etc/pki/galera-ca') }}"
# Create a certificate authority if one does not already exist
galera_pki_create_ca: "{{ openstack_pki_authorities is not defined | bool }}"
galera_pki_regen_ca: ''
galera_pki_regen_ca: ""
galera_pki_authorities:
- name: "MariaDBRoot"
@ -241,7 +241,7 @@ galera_pki_intermediate_cert_path: >-
{{
galera_pki_dir ~ '/roots/' ~ galera_pki_intermediate_cert_name ~ '/certs/' ~ galera_pki_intermediate_cert_name ~ '.crt'
}}
galera_pki_regen_cert: ''
galera_pki_regen_cert: ""
galera_pki_certificates:
- name: "galera_{{ ansible_facts['hostname'] }}"
provider: ownca
@ -289,7 +289,6 @@ galera_pki_install_certificates:
group: "root"
mode: "0644"
# MariaDB 10.1+ ships with 'PrivateDevices=True' in the systemd unit file. This
# provides some additional security, but it causes problems with systemd 219.
# While the security enhancements are helpful on bare metal hosts with multiple
@ -346,7 +345,7 @@ galera_mariadb_backups_user: galera_mariadb_backup
galera_mariadb_backups_suffix: "{{ inventory_hostname }}"
galera_mariadb_backups_cnf_file: "/etc/mysql/mariabackup.cnf"
galera_mariadb_backups_nodes: ["{{ galera_cluster_members[0] }}"]
galera_mariadb_backups_compress: False
galera_mariadb_backups_compress: false
galera_mariadb_backups_compressor: gzip
galera_mariadb_encryption_enabled: false

View File

@ -51,7 +51,7 @@
service:
name: "{{ galera_mariadb_service_name }}"
state: stopped
enabled: yes
enabled: true
changed_when: true
listen:
- Restart all mysql
@ -78,7 +78,7 @@
service:
name: "{{ galera_mariadb_service_name }}"
state: "{{ (not hostvars[item]['galera_cluster_ready'] | bool or galera_force_bootstrap | bool) | ternary('started', 'restarted') }}"
enabled: yes
enabled: true
environment:
MYSQLD_STARTUP_TIMEOUT: 180
register: galera_restart

View File

@ -14,12 +14,12 @@ platforms:
privileged: true
pre_build_image: true
docker_networks:
- name: 'galera'
- name: "galera"
ipam_config:
- subnet: '10.1.0.0/24'
- subnet: "10.1.0.0/24"
networks:
- name: "galera"
ipv4_address: '10.1.0.2'
ipv4_address: "10.1.0.2"
- name: galera02
groups:
- galera_all
@ -28,12 +28,12 @@ platforms:
privileged: true
pre_build_image: true
docker_networks:
- name: 'galera'
- name: "galera"
ipam_config:
- subnet: '10.1.0.0/24'
- subnet: "10.1.0.0/24"
networks:
- name: "galera"
ipv4_address: '10.1.0.3'
ipv4_address: "10.1.0.3"
- name: galera03
groups:
- galera_all
@ -42,12 +42,12 @@ platforms:
privileged: true
pre_build_image: true
docker_networks:
- name: 'galera'
- name: "galera"
ipam_config:
- subnet: '10.1.0.0/24'
- subnet: "10.1.0.0/24"
networks:
- name: "galera"
ipv4_address: '10.1.0.4'
ipv4_address: "10.1.0.4"
provisioner:
name: ansible
inventory:

View File

@ -70,7 +70,7 @@
- name: Update apt repositories when config is changed
apt:
update_cache: yes
update_cache: true
when: (apt_repo_removed is changed) or (deb822_repos is changed)
- name: Preseed galera password(s)
@ -80,14 +80,14 @@
value: "{{ item.value }}"
vtype: "{{ item.vtype }}"
with_items: "{{ galera_debconf_items }}"
no_log: yes
no_log: true
- name: Install galera role remote packages (apt)
apt:
name: "{{ galera_packages_list }}"
state: "{{ galera_package_state }}"
policy_rc_d: 101
update_cache: yes
update_cache: true
cache_valid_time: "{{ cache_timeout }}"
register: install_remote_apt_packages
until: install_remote_apt_packages is success

View File

@ -43,9 +43,9 @@
- name: Stat /etc/my.cnf.d
stat:
path: /etc/my.cnf.d
get_attributes: no
get_checksum: no
get_mime: no
get_attributes: false
get_checksum: false
get_mime: false
register: mycnfd_stat
- name: Destroy my.cnf.d dir if is dir
@ -70,7 +70,7 @@
with_items:
- path: "/etc/mysql"
state: "directory"
mode: '0755'
mode: "0755"
- path: "/etc/mysql/conf.d"
state: "directory"
- src: "/usr/lib64/galera"
@ -90,7 +90,7 @@
copy:
src: "gpg/{{ item.key | basename }}"
dest: "{{ item.key }}"
mode: '0644'
mode: "0644"
with_items: "{{ galera_gpg_keys }}"
when:
- galera_install_method == 'external_repo'
@ -101,8 +101,8 @@
description: "{{ galera_repo.description }}"
baseurl: "{{ galera_repo.baseurl }}"
gpgkey: "{{ galera_repo.gpgkey | default(omit) }}"
gpgcheck: yes
enabled: yes
gpgcheck: true
enabled: true
module_hotfixes: true
priority: 25
state: "{{ galera_repo.state | default(omit) }}"

View File

@ -42,10 +42,10 @@
--defaults-file={{ galera_mariadb_backups_cnf_file }}
--compress={{ galera_mariadb_backups_compress }} --compressor={{ galera_mariadb_backups_compressor }}
environment:
UMASK: '0640'
UMASK_DIR: '0750'
UMASK: "0640"
UMASK_DIR: "0750"
program_sandboxing:
RuntimeDirectory: 'mariabackup-galera'
RuntimeDirectory: "mariabackup-galera"
timer:
state: "started"
options:
@ -71,10 +71,10 @@
--defaults-file={{ galera_mariadb_backups_cnf_file }}
--compress={{ galera_mariadb_backups_compress }} --compressor={{ galera_mariadb_backups_compressor }}
environment:
UMASK: '0640'
UMASK_DIR: '0750'
UMASK: "0640"
UMASK_DIR: "0750"
program_sandboxing:
RuntimeDirectory: 'mariabackup-galera'
RuntimeDirectory: "mariabackup-galera"
timer:
state: "started"
options:
@ -93,7 +93,7 @@
password: "{{ galera_mariadb_backups_password }}"
host: "%"
priv: "*.*:RELOAD,PROCESS,LOCK TABLES,REPLICATION CLIENT"
append_privs: yes
append_privs: true
login_unix_socket: "{{ galera_unix_socket }}"
check_hostname: false
no_log: true

View File

@ -20,7 +20,7 @@
mode: "{{ item.mode | default('0644') }}"
config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}"
ignore_none_type: False
ignore_none_type: false
when: item.condition | default(True)
with_items:
- src: encryption.cnf.j2
@ -54,7 +54,7 @@
delegate_to: "localhost"
run_once: true
- name: Create encryption keys if the user does not specify them and put them on the deploy host # noqa: no-changed-when risky-shell-pipe
- name: Create encryption keys if the user does not specify them and put them on the deploy host # noqa: no-changed-when risky-shell-pipe
shell: "for i in {1..2}; do echo \"$i;$(openssl rand -hex 32)\"; done | tee {{ galera_db_encryption_tmp_dir }}/mysql_encryption_keys > /dev/null"
delegate_to: "localhost"
run_once: true
@ -92,7 +92,7 @@
owner: mysql
group: mysql
mode: "0600"
force: false # only copy the file if it does not exist
force: false # only copy the file if it does not exist
notify: Restart all mysql
- name: Copy password to file to servers

View File

@ -20,13 +20,13 @@
systemd_tempd_prefix: openstack
systemd_services:
- service_name: "{{ galera_mariadb_service_name }}"
systemd_overrides_only: True
systemd_overrides_only: true
systemd_overrides: "{{ galera_init_defaults | combine(galera_init_overrides, recursive=True) }}"
- service_name: "mariadbcheck@"
service_type: "oneshot"
execstarts: "-/usr/local/bin/clustercheck"
enabled: False
load: False
enabled: false
load: false
standard_output: "socket"
after_targets: []
sockets:
@ -116,7 +116,7 @@
mode: "{{ item.mode | default('0644') }}"
config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}"
ignore_none_type: False
ignore_none_type: false
when: item.condition | default(True)
with_items:
- src: my.cnf.j2

View File

@ -19,7 +19,7 @@
command: /usr/bin/mariadb-upgrade --check-if-upgrade-is-needed
register: galera_upgrade_check
failed_when: galera_upgrade_check.rc == 0
changed_when: False
changed_when: false
rescue:
- name: Run MySQL Upgrade
command: /usr/bin/mariadb-upgrade
@ -46,4 +46,4 @@
until: galera_users is success
retries: 3
delay: 10
no_log: True
no_log: true

View File

@ -17,7 +17,7 @@
cache_timeout: 600
# Default private device setting
_galera_disable_privatedevices: yes
_galera_disable_privatedevices: true
galera_server_required_distro_packages:
- apt-transport-https
@ -49,7 +49,7 @@ _galera_architecture_mapping:
# the preseed task and the service startup control used when installing
# mariadb-galera-server and galera.
galera_server_mariadb_distro_packages:
- findutils # "find" is used by wsrep_sst_mariabackup script
- findutils # "find" is used by wsrep_sst_mariabackup script
- libmariadb-dev
- mariadb-client
- mariadb-backup

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.
galera_init_defaults:
Service:
LimitNOFILE: "{{ galera_file_limits }}"
@ -40,12 +38,12 @@ _galera_base_users:
priv: "*.*:ALL,GRANT"
state: present
- name: "{{ galera_monitoring_user }}"
host: '%'
host: "%"
password: "{{ galera_monitoring_user_password }}"
priv: "*.*:USAGE"
state: present
- name: "{{ galera_monitoring_user }}"
host: 'localhost'
host: "localhost"
password: "{{ galera_monitoring_user_password }}"
priv: "*.*:USAGE"
state: present

View File

@ -22,10 +22,10 @@ _galera_gpg_keys:
# This provides some additional security, but it causes problems with creating
# mount namespaces on CentOS 7 with systemd 219. Setting the following variable
# to 'yes' will disable the PrivateDevices
_galera_disable_privatedevices: yes
_galera_disable_privatedevices: true
galera_server_required_distro_packages:
- findutils # "find" is used by wsrep_sst_mariabackup script
- findutils # "find" is used by wsrep_sst_mariabackup script
- gnupg2
- libaio
- libstdc++