From be093f9f58c6d0f2bf0a7b550f4de2eba996ed02 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Thu, 13 Feb 2025 09:04:48 +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: Ia76cbf1f2913dc4e03e19200f53d51f027769306 --- .gitignore | 1 + defaults/main.yml | 2 +- examples/playbook.yml | 13 +++++++------ handlers/main.yml | 4 ++-- tasks/systemd_install.yml | 4 ++-- tasks/systemd_mounts.yml | 6 +++--- vars/debian.yml | 1 + vars/redhat.yml | 1 + 8 files changed, 18 insertions(+), 14 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 2339e93..fcf3c51 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -21,7 +21,7 @@ systemd_centos_epel_key: >- # Any optioned required to make the mount point work. If no options are # provided the default will be used. This list is comma separted. # https://www.freedesktop.org/software/systemd/man/systemd.mount.html#Options= -systemd_default_mount_options: 'defaults' +systemd_default_mount_options: "defaults" # The systemd mounts dictionary is a set of mounts that will be created. The # dictionary can contain the following options: diff --git a/examples/playbook.yml b/examples/playbook.yml index c656e96..1c4f4c0 100644 --- a/examples/playbook.yml +++ b/examples/playbook.yml @@ -1,3 +1,4 @@ +--- - name: Create a systemd mount file for Mount1 and 2 hosts: localhost become: true @@ -6,14 +7,14 @@ vars: systemd_mounts: machines: - what: '/var/lib/machines.raw' - where: '/var/lib/machines' - type: 'btrfs' - options: 'loop' + what: "/var/lib/machines.raw" + where: "/var/lib/machines" + type: "btrfs" + options: "loop" unit: ConditionPathExists: - - '/var/lib/machines.raw' - state: 'started' + - "/var/lib/machines.raw" + state: "started" enabled: true glance_images: config_overrides: {} diff --git a/handlers/main.yml b/handlers/main.yml index 68121ea..1dfd62e 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -33,6 +33,6 @@ - name: Reload systemd daemon systemd: - daemon_reload: yes - no_block: yes + daemon_reload: true + no_block: true listen: Remove mount diff --git a/tasks/systemd_install.yml b/tasks/systemd_install.yml index 82cc136..35035c9 100644 --- a/tasks/systemd_install.yml +++ b/tasks/systemd_install.yml @@ -38,8 +38,8 @@ name: epel-systemd_mounts baseurl: "{{ systemd_centos_epel_mirror ~ '/' ~ ansible_facts['distribution_major_version'] ~ '/Everything/' ~ ansible_facts['architecture'] }}" description: "Extra Packages for Enterprise Linux {{ ansible_facts['distribution_major_version'] }} - $basearch" - gpgcheck: yes - enabled: yes + gpgcheck: true + enabled: true state: present includepkgs: "s3fs-fuse" register: install_epel_repo diff --git a/tasks/systemd_mounts.yml b/tasks/systemd_mounts.yml index 7f9536c..0daffb3 100644 --- a/tasks/systemd_mounts.yml +++ b/tasks/systemd_mounts.yml @@ -66,7 +66,7 @@ - name: Load or Unload mount(s) systemd: - daemon_reload: yes + daemon_reload: true name: "{{ mount_service_name.stdout }}" enabled: "{{ item.enabled | default(true) }}" when: @@ -103,10 +103,10 @@ - name: Unload mount(s) systemd: - daemon_reload: yes + daemon_reload: true name: "{{ mount_service_name.stdout }}" enabled: false - no_block: yes + no_block: true when: - item.state | default('unknown') == 'absent' notify: Remove mount diff --git a/vars/debian.yml b/vars/debian.yml index e2aa73d..72e423d 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -1,3 +1,4 @@ +--- systemd_nfs_packages: - nfs-common diff --git a/vars/redhat.yml b/vars/redhat.yml index 5babc3e..385954a 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -1,3 +1,4 @@ +--- systemd_nfs_packages: - nfs-utils