Is there a way you can send a mail with-in assert when any_errors_fatal: true ? I have tried to do it by using set_fact still, but still not having success in sending the disk limit size via email.
name: Assert that the disk limit ({{ disk_limit }}) has not exceeded
assert:
that: ( (disk_usage|float)/mount.size_total ) < disk_limit|float
msg: “Disk usage {{ disk_usage_ratio_s }} exceeds {{ disk_limit_ratio_s }}”
any_errors_fatal: true
Thanks that worked! Only issue is now that it is sending an email with the status of all the mounts one at a time. Is there anyway I can limit email to the on mount that actually hits the threshold?
yes… So one mount is at 80 percent threshold. when the playbook runs it sends individual emails for every mount on the server that has not reached the 80 percent… I am trying the proper way to get the output after the assert to send the email with only the mount that is at 80%.