From 5f1a3b2da15d59cff2b799aed77432bc2f6c179c Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Wed, 12 Feb 2025 08:31:16 +0100 Subject: [PATCH] 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: I96f2934f392affc01cdf3b85ad9198e21a6991be --- .gitignore | 1 + defaults/main.yml | 65 ++++++++++++------------- handlers/main.yml | 4 +- tasks/configure_metal_hosts.yml | 2 +- tasks/main.yml | 8 +-- tasks/openstack_hosts_configure_apt.yml | 6 +-- tasks/openstack_hosts_configure_dnf.yml | 6 +-- tasks/openstack_hosts_configure_yum.yml | 6 +-- tasks/openstack_sysstat.yml | 2 +- tasks/openstack_update_hosts_file.yml | 4 +- vars/redhat-9.yml | 6 +-- 11 files changed, 55 insertions(+), 55 deletions(-) diff --git a/.gitignore b/.gitignore index 3a772066..fe6585aa 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,7 @@ logs/* .tox *.egg-info .eggs +.ansible # Generated by pbr while building docs ###################################### diff --git a/defaults/main.yml b/defaults/main.yml index 4c2fbbf4..01918015 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -21,7 +21,7 @@ openstack_distrib_id: "OSA" openstack_distrib_release: "{{ openstack_release | default('master') }}" openstack_distrib_code_name: "Dalmatian" openstack_distrib_description: "OpenStack-Ansible" -openstack_distrib_file: yes +openstack_distrib_file: true openstack_distrib_file_path: "/etc/openstack-release" openstack_host_sysstat_enabled: true @@ -115,32 +115,32 @@ openstack_host_nf_conntrack_max: 262144 # System control kernel tuning openstack_kernel_options: - - { key: 'fs.inotify.max_user_watches', value: 1048576 } - - { key: 'net.ipv4.conf.all.rp_filter', value: "{{ openstack_host_rp_filter_all }}" } - - { key: 'net.ipv4.conf.default.rp_filter', value: "{{ openstack_host_rp_filter_default }}" } - - { key: 'net.ipv4.ip_forward', value: 1 } - - { key: 'net.netfilter.nf_conntrack_max', value: "{{ openstack_host_nf_conntrack_max }}" } - - { key: 'vm.dirty_background_ratio', value: 5 } - - { key: 'vm.dirty_ratio', value: 10 } - - { key: 'vm.swappiness', value: 5 } - - { key: 'net.bridge.bridge-nf-call-ip6tables', value: 1 } - - { key: 'net.bridge.bridge-nf-call-iptables', value: 1 } - - { key: 'net.bridge.bridge-nf-call-arptables', value: 1 } - - { key: 'net.ipv4.igmp_max_memberships', value: 1024 } - - { key: 'net.ipv4.neigh.default.gc_thresh1', value: "{{ set_gc_val | int // 2 }}" } - - { key: 'net.ipv4.neigh.default.gc_thresh2', value: "{{ set_gc_val | int }}" } - - { key: 'net.ipv4.neigh.default.gc_thresh3', value: "{{ set_gc_val | int * 2 }}" } - - { key: 'net.ipv4.route.gc_thresh', value: "{{ set_gc_val | int * 2 }}" } - - { key: 'net.ipv4.neigh.default.gc_interval', value: 60 } - - { key: 'net.ipv4.neigh.default.gc_stale_time', value: 120 } - - { key: 'net.ipv6.neigh.default.gc_thresh1', value: "{{ set_gc_val | int // 2 }}" } - - { key: 'net.ipv6.neigh.default.gc_thresh2', value: "{{ set_gc_val | int }}" } - - { key: 'net.ipv6.neigh.default.gc_thresh3', value: "{{ set_gc_val | int * 2 }}" } - - { key: 'net.ipv6.route.gc_thresh', value: "{{ set_gc_val | int * 2 }}" } - - { key: 'net.ipv6.neigh.default.gc_interval', value: 60 } - - { key: 'net.ipv6.neigh.default.gc_stale_time', value: 120 } - - { key: 'net.ipv6.conf.lo.disable_ipv6', value: 0 } - - { key: 'fs.aio-max-nr', value: 131072 } + - { key: "fs.inotify.max_user_watches", value: 1048576 } + - { key: "net.ipv4.conf.all.rp_filter", value: "{{ openstack_host_rp_filter_all }}" } + - { key: "net.ipv4.conf.default.rp_filter", value: "{{ openstack_host_rp_filter_default }}" } + - { key: "net.ipv4.ip_forward", value: 1 } + - { key: "net.netfilter.nf_conntrack_max", value: "{{ openstack_host_nf_conntrack_max }}" } + - { key: "vm.dirty_background_ratio", value: 5 } + - { key: "vm.dirty_ratio", value: 10 } + - { key: "vm.swappiness", value: 5 } + - { key: "net.bridge.bridge-nf-call-ip6tables", value: 1 } + - { key: "net.bridge.bridge-nf-call-iptables", value: 1 } + - { key: "net.bridge.bridge-nf-call-arptables", value: 1 } + - { key: "net.ipv4.igmp_max_memberships", value: 1024 } + - { key: "net.ipv4.neigh.default.gc_thresh1", value: "{{ set_gc_val | int // 2 }}" } + - { key: "net.ipv4.neigh.default.gc_thresh2", value: "{{ set_gc_val | int }}" } + - { key: "net.ipv4.neigh.default.gc_thresh3", value: "{{ set_gc_val | int * 2 }}" } + - { key: "net.ipv4.route.gc_thresh", value: "{{ set_gc_val | int * 2 }}" } + - { key: "net.ipv4.neigh.default.gc_interval", value: 60 } + - { key: "net.ipv4.neigh.default.gc_stale_time", value: 120 } + - { key: "net.ipv6.neigh.default.gc_thresh1", value: "{{ set_gc_val | int // 2 }}" } + - { key: "net.ipv6.neigh.default.gc_thresh2", value: "{{ set_gc_val | int }}" } + - { key: "net.ipv6.neigh.default.gc_thresh3", value: "{{ set_gc_val | int * 2 }}" } + - { key: "net.ipv6.route.gc_thresh", value: "{{ set_gc_val | int * 2 }}" } + - { key: "net.ipv6.neigh.default.gc_interval", value: 60 } + - { key: "net.ipv6.neigh.default.gc_stale_time", value: 120 } + - { key: "net.ipv6.conf.lo.disable_ipv6", value: 0 } + - { key: "fs.aio-max-nr", value: 131072 } # Optional user defined list of sysctl options in the same dict item format as # above. @@ -165,7 +165,7 @@ openstack_domain: openstack.local global_environment_variables: {} # Set the default mode for the /etc/cron.d/sysstat file -openstack_host_sysstat_cron_mode: '0755' +openstack_host_sysstat_cron_mode: "0755" ## Default repositories data # Set default mirror for CentOS repositories @@ -173,19 +173,18 @@ openstack_host_sysstat_cron_mode: '0755' openstack_hosts_centos_mirror_url: "{{ centos_mirror_url | default('http://mirror.centos.org/centos') }}" # openstack_hosts_rdo_repo_type can be trunk or cloudsig openstack_hosts_rdo_repo_type: trunk -openstack_hosts_rdo_mirror_url: 'https://trunk.rdoproject.org' +openstack_hosts_rdo_mirror_url: "https://trunk.rdoproject.org" openstack_hosts_rdo_repo_url: "{{ _openstack_hosts_rdo_repo_url }}" openstack_hosts_rdo_deps_url: "{{ _openstack_hosts_rdo_deps_url }}" openstack_hosts_power_tool_enable: >- {{ ('repo_all' in groups or 'manila_all' in groups or 'gnocchi_all' in groups or install_method | default('source') == 'distro') }} # Keep a history of systemd journals on disk after reboots -openstack_host_keep_journals: yes +openstack_host_keep_journals: true # Define arbitrary configration for systemd-journald openstack_hosts_journald_config: {} - # Enable/Disable the yum fastestmirror plugin -openstack_hosts_enable_yum_fastestmirror: yes +openstack_hosts_enable_yum_fastestmirror: true # user supplied list of CA certificates to copy to hosts from the deploy host # example: @@ -198,7 +197,7 @@ openstack_ca_bundle_path: "{{ _openstack_ca_bundle_path }}" # extra configuration for OS package manager openstack_hosts_package_manager_default_conf: "{{ _openstack_hosts_package_manager_default_conf | default('') }}" -openstack_hosts_package_manager_extra_conf: '' +openstack_hosts_package_manager_extra_conf: "" # apt pins to apply to all hosts in the deployment # the default is to make ceph packages from UCA lower priority than those from the ubuntu distro repo diff --git a/handlers/main.yml b/handlers/main.yml index 31cb13c5..68d67171 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -23,7 +23,7 @@ service: name: systemd-journald state: restarted - enabled: yes + enabled: true register: _restart until: _restart is success retries: 5 @@ -31,4 +31,4 @@ - name: Systemd daemon reload systemd: - daemon_reload: yes + daemon_reload: true diff --git a/tasks/configure_metal_hosts.yml b/tasks/configure_metal_hosts.yml index 7d51bcf4..8392b318 100644 --- a/tasks/configure_metal_hosts.yml +++ b/tasks/configure_metal_hosts.yml @@ -78,7 +78,7 @@ sysctl_set: "{{ item.set | default('yes') }}" sysctl_file: "{{ openstack_hosts_sysctl_file }}" state: "{{ item.state | default('present') }}" - reload: no + reload: false with_items: "{{ openstack_kernel_options + openstack_user_kernel_options }}" failed_when: false diff --git a/tasks/main.yml b/tasks/main.yml index 4cb27b0d..7fff2e7b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -57,8 +57,8 @@ lineinfile: path: /etc/pam.d/sudo line: "session required pam_env.so readenv=1 user_readenv=0" - regexp: 'session\s+required\s+pam_env\.so' - insertbefore: '^@include' + regexp: "session\\s+required\\s+pam_env\\.so" + insertbefore: "^@include" when: ansible_facts['distribution'] | lower == 'debian' - name: Create systemd global directory @@ -121,10 +121,10 @@ sysctl: name: "net.ipv4.tcp_retries2" value: "{{ keepalived_sysctl_tcp_retries | default(8) }}" - sysctl_set: yes + sysctl_set: true sysctl_file: "{{ openstack_hosts_sysctl_file }}" state: "{{ (keepalived_sysctl_tcp_retries | default(8) > 0) | ternary('present', 'absent') }}" - reload: yes + reload: true failed_when: false - name: Install distro packages diff --git a/tasks/openstack_hosts_configure_apt.yml b/tasks/openstack_hosts_configure_apt.yml index e3be72ab..29cd2161 100644 --- a/tasks/openstack_hosts_configure_apt.yml +++ b/tasks/openstack_hosts_configure_apt.yml @@ -21,7 +21,7 @@ state: directory owner: root group: root - mode: '0755' + mode: "0755" - name: Validate repo config is deb822 format vars: @@ -46,7 +46,7 @@ apt: name: "{{ openstack_hosts_package_list | rejectattr('state', 'equalto', 'absent') | map(attribute='name') | list }}" state: "{{ openstack_hosts_package_state }}" - update_cache: yes + update_cache: true cache_valid_time: "{{ cache_timeout }}" register: _install_packages until: _install_packages is success @@ -90,7 +90,7 @@ - name: Update Apt cache apt: - update_cache: yes + update_cache: true when: - (_manage_apt_repositories is changed) or (_cleanup_apt_repositories is changed) register: _update_apt_cache diff --git a/tasks/openstack_hosts_configure_dnf.yml b/tasks/openstack_hosts_configure_dnf.yml index 3969b49b..f614364b 100644 --- a/tasks/openstack_hosts_configure_dnf.yml +++ b/tasks/openstack_hosts_configure_dnf.yml @@ -24,7 +24,7 @@ section: main option: enabled value: "{{ (openstack_hosts_enable_yum_fastestmirror | bool) | ternary('1', '0') }}" - no_extra_spaces: yes + no_extra_spaces: true mode: "0644" when: - fastestmirror_plugin_check.stat.exists @@ -44,7 +44,7 @@ copy: src: "{{ item.keyfile }}" dest: "{{ item.key }}" - mode: '0644' + mode: "0644" with_items: "{{ openstack_hosts_package_repos_keys | selectattr('keyfile', 'defined') | list }}" - name: Ensure GPG keys have the correct SELinux contexts applied @@ -98,7 +98,7 @@ block: "{{ openstack_hosts_package_manager_default_conf + openstack_hosts_package_manager_extra_conf }}" path: /etc/dnf/dnf.conf marker: "# {mark} OPENSTACK-ANSIBLE-OPENSTACK_HOSTS MANAGED BLOCK" - create: yes + create: true mode: "0644" when: - openstack_hosts_package_manager_extra_conf | length > 0 or openstack_hosts_package_manager_default_conf | length > 0 diff --git a/tasks/openstack_hosts_configure_yum.yml b/tasks/openstack_hosts_configure_yum.yml index a0460af2..94eb0ccc 100644 --- a/tasks/openstack_hosts_configure_yum.yml +++ b/tasks/openstack_hosts_configure_yum.yml @@ -24,7 +24,7 @@ section: main option: enabled value: "{{ (openstack_hosts_enable_yum_fastestmirror | bool) | ternary('1', '0') }}" - no_extra_spaces: yes + no_extra_spaces: true mode: "0644" when: - fastestmirror_plugin_check.stat.exists @@ -44,7 +44,7 @@ copy: src: "{{ item.keyfile }}" dest: "{{ item.key }}" - mode: '0644' + mode: "0644" with_items: "{{ openstack_hosts_package_repos_keys | selectattr('keyfile', 'defined') | list }}" - name: Ensure GPG keys have the correct SELinux contexts applied @@ -96,7 +96,7 @@ block: "{{ openstack_hosts_package_manager_default_conf + openstack_hosts_package_manager_extra_conf }}" path: /etc/yum.conf marker: "# {mark} OPENSTACK-ANSIBLE-OPENSTACK_HOSTS MANAGED BLOCK" - create: yes + create: true mode: "0644" when: - openstack_hosts_package_manager_extra_conf | length > 0 or openstack_hosts_package_manager_default_conf | length > 0 diff --git a/tasks/openstack_sysstat.yml b/tasks/openstack_sysstat.yml index 6c00db04..09e225d2 100644 --- a/tasks/openstack_sysstat.yml +++ b/tasks/openstack_sysstat.yml @@ -33,6 +33,6 @@ service: name: sysstat state: started - enabled: yes + enabled: true when: - ansible_facts['pkg_mgr'] == 'dnf' diff --git a/tasks/openstack_update_hosts_file.yml b/tasks/openstack_update_hosts_file.yml index 54b79ab9..06c1df39 100644 --- a/tasks/openstack_update_hosts_file.yml +++ b/tasks/openstack_update_hosts_file.yml @@ -52,8 +52,8 @@ dest: /etc/hosts block: "{{ (_etc_hosts_content + openstack_host_custom_hosts_records) | join('\n') }}" marker: "### {mark} OPENSTACK-ANSIBLE {{ lookup('env', 'OSA_CONFIG_DIR') }} MANAGED BLOCK ###" - run_once: True + run_once: true delegate_to: localhost - become: True + become: true when: - openstack_host_manage_deploy_hosts_file | bool diff --git a/vars/redhat-9.yml b/vars/redhat-9.yml index ed9e1fde..799b7609 100644 --- a/vars/redhat-9.yml +++ b/vars/redhat-9.yml @@ -20,7 +20,7 @@ openstack_host_sysstat_cron_file: /etc/cron.d/sysstat openstack_host_cron_template: sysstat.cron.redhat.j2 openstack_host_module_file: /etc/modules-load.d/openstack-ansible.conf -openstack_host_sysstat_cron_mode: '0600' +openstack_host_sysstat_cron_mode: "0600" ## Kernel modules loaded on hosts openstack_host_kernel_modules: @@ -98,8 +98,8 @@ _package_repos_trunk: file: rdo-deps description: rdo-deps baseurl: "{{ openstack_hosts_rdo_deps_url }}" - gpgcheck: no - module_hotfixes: yes + gpgcheck: false + module_hotfixes: true _package_repos: |- {% if openstack_hosts_rdo_repo_type == 'trunk' %}