fix ansible-lint errors

This commit is contained in:
Sergey Malyuk
2026-03-19 12:39:54 +03:00
parent 984f385a8b
commit 24a471b654
5 changed files with 79 additions and 79 deletions

View File

@@ -7,8 +7,8 @@
virtual_group: "group"
logical_volume: "volume"
lvm_dev: "/dev/loop0"
fs_type: ext4
storage_mountpoint: "/mnt"
make_lv_fs_type: ext4
make_lv_storage_mountpoint: "/mnt"
tasks:
- name: Get volume group list
@@ -17,11 +17,11 @@
executable: /bin/bash
changed_when: false
failed_when: false
register: vg_list
register: make_lv_vg_list
- name: Assert that volume group exists
ansible.builtin.assert:
that: virtual_group in vg_list.stdout
that: virtual_group in make_lv_vg_list.stdout
success_msg: "{{ lvm_dev }} has {{ virtual_group }} group"
fail_msg: "{{ lvm_dev }} DOES NOT have {{ virtual_group }} group"
@@ -31,11 +31,11 @@
executable: /bin/bash
changed_when: false
failed_when: false
register: lv_list
register: make_lv_lv_list
- name: Assert that logical volume exists
ansible.builtin.assert:
that: logical_volume in lv_list.stdout
that: logical_volume in make_lv_lv_list.stdout
success_msg: "{{ virtual_group }} has {{ logical_volume }} volume"
fail_msg: "{{ virtual_group }} DOES NOT have {{ logical_volume }} volume"
@@ -43,23 +43,23 @@
ansible.builtin.command: "blkid /dev/mapper/{{ virtual_group }}-{{ logical_volume }} -o value -s TYPE"
changed_when: false
failed_when: false
register: current_fs
register: make_lv_current_fs
- name: Assert that current filesystem is the required one
ansible.builtin.assert:
that: current_fs.stdout == fs_type
success_msg: "{{ virtual_group }} - {{ logical_volume }} has {{ fs_type }} filesystem"
fail_msg: "{{ virtual_group }} - {{ logical_volume }} DOES NOT have {{ fs_type }} filesystem"
that: make_lv_current_fs.stdout == make_lv_fs_type
success_msg: "{{ virtual_group }} - {{ logical_volume }} has {{ make_lv_fs_type }} filesystem"
fail_msg: "{{ virtual_group }} - {{ logical_volume }} DOES NOT have {{ make_lv_fs_type }} filesystem"
- name: Get logical volume mount info # noqa: command-instead-of-module — tells ansible-lint to ignore the error, because you can't actually
# do it with ansible.builtin.mount as the linter begs me to do
ansible.builtin.shell: "mount | grep -w '{{ virtual_group }}-{{ logical_volume }}'"
register: mount_check
register: make_lv_mount_check
ignore_errors: true
changed_when: false
- name: Assert that volume is mounted
ansible.builtin.assert:
that: mount_check.rc == 0
success_msg: "{{ virtual_group }}-{{ logical_volume }} is mounted at {{ storage_mountpoint }}"
fail_msg: "{{ virtual_group }}-{{ logical_volume }} IS NOT mounted at {{ storage_mountpoint }}"
that: make_lv_mount_check.rc == 0
success_msg: "{{ virtual_group }}-{{ logical_volume }} is mounted at {{ make_lv_storage_mountpoint }}"
fail_msg: "{{ virtual_group }}-{{ logical_volume }} IS NOT mounted at {{ make_lv_storage_mountpoint }}"