Instead of throwing FATAL errors out there, can we do something like? It will say “Volume group vgaris does not exist” if the VG doesnt exist,
and if it is like creating the 3g instead of 7G, it will say, “insufficient space, will create the 3G”
My playbook:
Although the docs on the size parameter don’t mention a default behavior, they do mention accepting a percentage of VG/PVS/FREE: https://docs.ansible.com/ansible/latest/collections/community/general/lvol_module.html#parameter-size.
There is an example about it as well with “100%FREE”:
https://docs.ansible.com/ansible/latest/collections/community/general/lvol_module.html#examples
This is what you are looking for (I think) - no need for trial and error.
Instead of failed for the server that doesnt have VG, it will show a message “no vg”, instead of showing fatal error. is there a way to replace the fatal errors with debug message?
You should rewrite your playbook to test for the existing of such a vg, and only add an lv if the upper vg exists.