From 6570c91955e3ae8e5320a8536a5d6680e011ca8a Mon Sep 17 00:00:00 2001 From: Evangelos Foutras <evangelos@foutrelis.com> Date: Mon, 4 Oct 2021 21:02:10 +0300 Subject: [PATCH] common: group mounts by uuid and scrub only the first sort + groupby fanciness by @klausenbusk. --- roles/common/tasks/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index ec658f3a4..b7702e441 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -37,8 +37,10 @@ - name: start and enable btrfs scrub timer service: name=btrfs-scrub@{{ '-' if (item.mount | length == 1) else (item.mount.split("/", 1)[1] | replace("/", "-")) }}.timer enabled=yes state=started - loop: "{{ ansible_mounts }}" - when: "item.fstype == 'btrfs' and item.mount != '/var/lib/docker/btrfs' and 'backup' not in item.mount" + loop: "{{ ansible_mounts | sort(attribute='mount') | groupby('uuid') | map(attribute=1) | map('first') }}" + when: + - item.fstype == 'btrfs' + - not 'backup' in item.mount - name: install mlocate pacman: name=mlocate state=present -- GitLab