From b6966bb57c35ee1e1eb6ce2a0ec72889b0ad09ce Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Wed, 12 Feb 2025 15:20:35 +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: Ib52a0b06e5beda167de7dcf3b7fb42bc9818be62 --- .gitignore | 1 + defaults/main.yml | 16 +++++++--------- examples/playbook.yml | 5 ++--- handlers/main.yml | 24 ++++++++++++------------ tasks/main.yml | 2 +- tasks/zun_compute.yml | 14 +++++++------- tasks/zun_post_install.yml | 2 +- vars/redhat.yml | 1 - 8 files changed, 31 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 3a77206..c46a9ec 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ logs/* # OS generated files # ###################### ._* +.ansible .tox *.egg-info .eggs diff --git a/defaults/main.yml b/defaults/main.yml index def093e..685b6b1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 zun_barbican_enabled: "{{ (groups['barbican_all'] is defined) and (groups['barbican_all'] | length > 0) }}" # Enable/Disable designate configurations @@ -24,7 +22,7 @@ zun_notifications_designate: notifications_designate zun_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (groups['ceilometer_all'] | length > 0) }}" ## Verbosity Options -debug: False +debug: false # python venv executable zun_venv_python_executable: "{{ openstack_venv_python_executable | default('python3') }}" @@ -65,7 +63,7 @@ zun_pip_install_args: "{{ pip_install_options | default('') }}" zun_venv_tag: "{{ venv_tag | default('untagged') }}" zun_bin: "/openstack/venvs/zun-{{ zun_venv_tag }}/bin" -zun_fatal_deprecations: False +zun_fatal_deprecations: false ## Zun user information zun_system_user_name: zun @@ -110,7 +108,7 @@ zun_docker_bind_host: "{{ openstack_service_bind_address | default('0.0.0.0') }} zun_docker_bind_port: 2375 # Should Docker image cache data be periodically cleaned up? -zun_docker_prune_images: False +zun_docker_prune_images: false # Time period for which to clean up old Docker data. The options are hour, day, # month, or year. (string value) @@ -290,7 +288,7 @@ zun_services: condition: "{{ inventory_hostname in groups['zun_compute'] }}" init_config_overrides: "{{ zun_kuryr_init_defaults | combine(zun_kuryr_init_overrides, recursive=True) }}" start_order: 3 - wsgi_app: True + wsgi_app: true wsgi: kuryr_libnetwork.server:app uwsgi_bind_address: "{{ zun_kuryr_service_address }}" uwsgi_port: "{{ zun_kuryr_service_port }}" @@ -302,7 +300,7 @@ zun_services: service_name: zun-api init_config_overrides: "{{ zun_api_init_overrides }}" start_order: 1 - wsgi_app: True + wsgi_app: true wsgi_path: "{{ zun_bin }}/zun-api-wsgi" uwsgi_bind_address: "{{ zun_service_address }}" uwsgi_port: "{{ zun_service_port }}" @@ -339,7 +337,7 @@ zun_services: service_name: docker init_config_overrides: {} start_order: 4 - systemd_overrides_only: True + systemd_overrides_only: true systemd_overrides: "{{ zun_docker_init_defaults | combine(zun_docker_init_overrides, recursive=True) }}" # Common pip packages @@ -427,7 +425,7 @@ zun_pki_setup_host: "{{ openstack_pki_setup_host | default('localhost') }}" zun_pki_keys_path: "{{ zun_pki_dir ~ '/certs/private/' }}" zun_pki_certs_path: "{{ zun_pki_dir ~ '/certs/certs/' }}" zun_pki_intermediate_cert_name: "{{ openstack_pki_service_intermediate_cert_name | default('ExampleCorpIntermediate') }}" -zun_pki_regen_cert: '' +zun_pki_regen_cert: "" zun_pki_san: "{{ openstack_pki_san | default('DNS:' ~ ansible_facts['hostname'] ~ ',IP:' ~ management_address) }}" zun_pki_certificates: - name: "zun_{{ ansible_facts['hostname'] }}" diff --git a/examples/playbook.yml b/examples/playbook.yml index d4a2dda..c3b3a47 100644 --- a/examples/playbook.yml +++ b/examples/playbook.yml @@ -1,14 +1,13 @@ --- - - name: Gather zun facts hosts: zun_all - gather_facts: True + gather_facts: true tags: - always - name: Install zun services hosts: zun_all - gather_facts: False + gather_facts: false serial: - 1 - "100%" diff --git a/handlers/main.yml b/handlers/main.yml index 743d019..8aef4a9 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -16,9 +16,9 @@ - name: Stop containerd systemd: name: "containerd" - enabled: yes + enabled: true state: "stopped" - daemon_reload: yes + daemon_reload: true register: _stop until: _stop is success retries: 5 @@ -28,9 +28,9 @@ - name: Start containerd systemd: name: "containerd" - enabled: yes + enabled: true state: "started" - daemon_reload: yes + daemon_reload: true register: _start until: _start is success retries: 5 @@ -40,9 +40,9 @@ - name: Stop docker systemd: name: "{{ item }}" - enabled: yes + enabled: true state: "stopped" - daemon_reload: yes + daemon_reload: true with_items: - docker - kuryr-libnetwork @@ -55,9 +55,9 @@ - name: Start docker systemd: name: "{{ item }}" - enabled: yes + enabled: true state: "started" - daemon_reload: yes + daemon_reload: true with_items: - kuryr-libnetwork - docker @@ -70,9 +70,9 @@ - name: Stop services systemd: name: "{{ item.service_name }}" - enabled: yes + enabled: true state: "stopped" - daemon_reload: yes + daemon_reload: true with_items: "{{ filtered_zun_services }}" register: _stop until: _stop is success @@ -87,9 +87,9 @@ - name: Start services systemd: name: "{{ item.service_name }}" - enabled: yes + enabled: true state: "started" - daemon_reload: yes + daemon_reload: true with_items: "{{ filtered_zun_services }}" register: _start until: _start is success diff --git a/tasks/main.yml b/tasks/main.yml index 8f717fe..d5f596f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -62,7 +62,7 @@ - name: Retrieve the constraints URL uri: url: "{{ zun_upper_constraints_url }}" - return_content: yes + return_content: true register: _u_c_contents - name: Install the python venv diff --git a/tasks/zun_compute.yml b/tasks/zun_compute.yml index 7aa0edb..275b635 100644 --- a/tasks/zun_compute.yml +++ b/tasks/zun_compute.yml @@ -79,7 +79,7 @@ - name: Update Apt cache apt: - update_cache: yes + update_cache: true when: (add_nv_repos is changed) or (_cleanup_apt_repositories is changed) register: update_apt_cache until: update_apt_cache is success @@ -95,8 +95,8 @@ description: "{{ item.description }}" baseurl: "{{ item.repo }}" gpgkey: "{{ item.gpgkey | default(omit) }}" - gpgcheck: yes - enabled: yes + gpgcheck: true + enabled: true priority: 25 register: add_docker_repos until: add_docker_repos is success @@ -131,7 +131,7 @@ get_url: url: "{{ zun_kata_package_source }}" dest: "/opt/{{ zun_kata_package_source | basename }}" - mode: '0440' + mode: "0440" checksum: "{{ zun_kata_package_checksum }}" register: _kata_downloaded @@ -139,7 +139,7 @@ unarchive: src: "/opt/{{ zun_kata_package_source | basename }}" dest: /opt/ - remote_src: True + remote_src: true owner: root group: root extra_opts: @@ -282,7 +282,7 @@ user: name: "{{ item }}" groups: "{{ zun_docker_groupname }}" - append: yes + append: true with_items: "{{ zun_docker_users }}" - name: Drop sudoers file @@ -306,7 +306,7 @@ systemd: name: multipathd state: started - enabled: yes + enabled: true - name: Create script to clean up old Docker data template: diff --git a/tasks/zun_post_install.yml b/tasks/zun_post_install.yml index abf0da6..c98ae97 100644 --- a/tasks/zun_post_install.yml +++ b/tasks/zun_post_install.yml @@ -80,7 +80,7 @@ - name: Synchronize the zun DB schema command: "{{ zun_bin }}/zun-db-manage --config-dir /etc/zun upgrade" - become: yes + become: true become_user: "{{ zun_system_user_name }}" changed_when: false when: diff --git a/vars/redhat.yml b/vars/redhat.yml index 0c1efa7..a64ca7c 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -22,7 +22,6 @@ zun_docker_repo: repo: "https://download.docker.com/linux/centos/{{ ansible_facts['distribution_major_version'] }}/$basearch/stable" gpgkey: "https://download.docker.com/linux/centos/gpg" - # Common yum packages zun_distro_packages: - git