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

@@ -13,11 +13,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"
@@ -27,11 +27,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"
@@ -39,25 +39,25 @@
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"
rescue:
- name: Unmount the main storage
ansible.posix.mount:
src: "/dev/{{ virtual_group }}/{{ logical_volume }}"
path: "{{ storage_mountpoint }}"
path: "{{ make_lv_storage_mountpoint }}"
state: absent
- name: Wipe disk signatures
ansible.builtin.command: "wipefs -af {{ lvm_dev }}"
register: wipefs_result
changed_when: wipefs_result.rc == 0
register: make_lv_wipefs_result
changed_when: make_lv_wipefs_result.rc == 0
- name: Create a volume group for the storage
community.general.lvg:
@@ -66,37 +66,37 @@
force: true
- name: Create a logical volume for the storage
when: is_container
when: make_lv_is_container
community.general.lvol:
vg: "{{ virtual_group }}"
lv: "{{ logical_volume }}"
size: "{{ size }}"
size: "{{ make_lv_size }}"
opts: "--config 'activation/udev_rules=0'"
- name: Create a logical volume for the storage
when: not is_container
when: not make_lv_is_container
community.general.lvol:
vg: "{{ virtual_group }}"
lv: "{{ logical_volume }}"
size: "{{ size }}"
size: "{{ make_lv_size }}"
opts: "--config 'activation/udev_rules=1'"
- name: Create a filesystem for the storage
community.general.filesystem:
dev: "/dev/{{ virtual_group }}/{{ logical_volume }}"
fstype: "{{ fs_type }}"
fstype: "{{ make_lv_fs_type }}"
- name: Create a mountpoint for the storage
ansible.builtin.file:
path: "{{ storage_mountpoint }}"
path: "{{ make_lv_storage_mountpoint }}"
state: directory
owner: "{{ mountpoint_owner }}"
group: "{{ mountpoint_group }}"
mode: "{{ storage_mountpoint_mode }}"
owner: "{{ make_lv_mountpoint_owner }}"
group: "{{ make_lv_mountpoint_group }}"
mode: "{{ make_lv_storage_mountpoint_mode }}"
- name: Mount the main storage
ansible.posix.mount:
src: "/dev/{{ virtual_group }}/{{ logical_volume }}"
path: "{{ storage_mountpoint }}"
fstype: "{{ fs_type }}"
path: "{{ make_lv_storage_mountpoint }}"
fstype: "{{ make_lv_fs_type }}"
state: mounted