Use assert module for IP asertion
In the list playbook we may want to use the assert module with something similar to this:
tasks:
- name: Test for 20% disk space available on {{ mountname }}
assert:
that: mount.size_available > mount.size_total|float * 0.2
msg: Disk space has reached the 80% threshold
register: disk_free
- name: For full systems, run splunk clean
command: "/opt/splunkforwarder/bin/splunk clean all -f"
when: disk_free|failed
vars:
mountname: '/opt/splunkforwarder'
mount: "{{ ansible_mounts | selectattr('mount','equalto', mountname) | first }}"