commit 5eca75c31f4ffe0c875b0bcdcc6245ca174799b3 Author: Mark Goddard Date: Tue Aug 4 17:17:38 2020 +0100 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 (cherry picked from commit 5ff5e6b10011875d1c29d16a8b39498adc0145e0) diff --git a/ansible/lvm.yml b/ansible/lvm.yml index 93d6102..5ca9f8a 100644 --- a/ansible/lvm.yml +++ b/ansible/lvm.yml @@ -4,7 +4,7 @@ tags: - lvm - upgrade-check - pre_tasks: + tasks: - name: Fail if the LVM physical disks have not been configured fail: msg: > @@ -13,6 +13,7 @@ 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: > @@ -21,10 +22,14 @@ each volume group in 'lvm_groups' has a valid 'disks' list. with_items: "{{ lvm_groups | default([]) }}" when: item.disks | string() == item.disks - roles: - - role: mrlesmithjr.manage-lvm - manage_lvm: True - become: True + + - 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