kayobe/ansible/lvm.yml
Mark Goddard 5ff5e6b100 Performance: skip LVM configuration if no groups configured
Currently we import the manage-lvm role with a condition that skips
tasks when no LVM groups are configured. At large scale this is
inefficient.

This change improves the performance for hosts where there are no LVM
groups configured, by using include_role rather than a static import.

Story: 2007993
Task: 40664

Change-Id: Ib51ac445cc787d7045d72a9ecec14434d432d9e7
2020-09-16 13:22:04 +00:00

36 lines
1.2 KiB
YAML

---
- name: Ensure LVM configuration is applied
hosts: seed-hypervisor:seed:overcloud
tags:
- lvm
- upgrade-check
tasks:
- name: Fail if the LVM physical disks have not been configured
fail:
msg: >
The physical disk list has not been configured for volume
{{ item.vgname }}. Ensure that each volume group in 'lvm_groups'
has a valid 'disks' list.
with_items: "{{ lvm_groups | default([]) }}"
when: not item.disks | default([]) or 'changeme' in item.disks | default([])
- name: Fail if the LVM physical disks are configured as a comma-separated string
fail:
msg: >
The physical disk list for volume {{ item.vgname }} must be
configured as a list instead of a comma-separated string. Ensure that
each volume group in 'lvm_groups' has a valid 'disks' list.
with_items: "{{ lvm_groups | default([]) }}"
when: item.disks | string() == item.disks
- name: Ensure LVM configuration is applied
vars:
manage_lvm: True
include_role:
name: mrlesmithjr.manage-lvm
apply:
become: True
when:
- lvm_groups is defined
- lvm_groups | length > 0