Merge "Block deletion of existing snapshots executing the creation command"

This commit is contained in:
Zuul 2022-12-13 04:42:25 +00:00 committed by Gerrit Code Review
commit 41e301f0ce
1 changed files with 16 additions and 1 deletions

View File

@ -91,9 +91,24 @@
command: lvremove -f /dev/vg/ss_audit
when: ansible_facts.lvm.lvs.ss_audit is defined
tags:
- create_snapshots
- remove_snapshots
- name: Check existing snapshots
block:
- name: Find snapshot files
find:
path: /dev/vg
patterns: ['ss_home','ss_log','ss_root','ss_srv','ss_var','ss_audit']
file_type: "link"
register: snapshots_found
- name: Evaluate result
fail: msg="Snapshot {{ item['path'] }} already exist in the filesystem"
loop: "{{ snapshots_found.files }}"
when: snapshots_found.matched > 0
tags:
- create_snapshots
- name: Create lvm snapshot if there are at least 8GB of free space in the vg volumegroup
when:
- ansible_facts.lvm is defined