linux-system-roles / storage

Ansible role for linux storage management
https://linux-system-roles.github.io/storage/
MIT License
101 stars 58 forks source link

Creating LV on existing VG not idempotent #384

Closed myllynen closed 10 months ago

myllynen commented 11 months ago

Using this playbook against a system which has an existing rootvg VG and more than 1G free space on it available works:

---
- name: Configure storage
  hosts: all
  become: true
  gather_facts: false
  vars:
    storage_pools:
      - name: rootvg
        volumes:
          - name: swap
            type: lvm
            size: 1G
            fs_type: swap
            fs_label: swap
  roles:
    - redhat.rhel_system_roles.storage

However on the subsequent runs the role is not idempotent:

...
TASK [redhat.rhel_system_roles.storage : Remove obsolete mounts]
Tuesday 26 September 2023  08:24:51 +0300 (0:00:00.016)       0:00:08.206
changed: [192.168.122.119] => (item={'src': '/dev/mapper/rootvg-swap', 'fstype': 'swap', 'path': 'none', 'state': 'absent'})

TASK [redhat.rhel_system_roles.storage : Tell systemd to refresh its view of /etc/fstab]
Tuesday 26 September 2023  08:24:52 +0300 (0:00:00.248)       0:00:08.454
ok: [192.168.122.119]

TASK [redhat.rhel_system_roles.storage : Set up new/current mounts]
Tuesday 26 September 2023  08:24:52 +0300 (0:00:00.487)       0:00:08.942
changed: [192.168.122.119] => (item={'src': '/dev/mapper/rootvg-swap', 'path': 'none', 'fstype': 'swap', 'opts': 'defaults', 'dump': 0, 'passno': 0, 'state': 'present', 'owner': None, 'group': None, 'mode': None})
...

Tested with Ansible 2.15.3 against RHEL 9.2. Thanks.

scaronni commented 10 months ago

Try with the latest release, I was hitting the same thing on my systems with swap partitions: https://github.com/linux-system-roles/storage/pull/396

After the merge / last release the role is idempotent on my long list of systems.

richm commented 10 months ago

@myllynen can you verify that your issue is fixed with the latest role?

myllynen commented 10 months ago

Thanks, I'm happy to confirm the patch fixes the issue!