I have a playbook that uses gather facts, then I use the ansible_mounts fact in a jinja2 template. In this template, I can print out each partition, the total size and total available. What I’d like to do is to also calculate the percentage of space available. I’m trying below, but keep getting a templating error when the playbook runs. Any ideas?
My apologies. I obviously forgot to add the error. I did find that I was missing a ‘)’ character at the end of the “Total Space” line. But now I get the following:
FAILED! => {“changed”: false, “msg”: “AnsibleUndefinedVariable: ‘dict object’ has no attribute ‘size’”}
The j2 file is above, but here’s the playbook I’m using:
My apologies. I obviously forgot to add the error. I did find that I was missing a ')' character at the end of the "Total Space" line. But now I get the following:
FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'size'"}
The j2 file is above, but here's the playbook I'm using: