I need to check all the linux servers which servers disk size is less than 10GB and also should display the output if it is in MB , GB , 1TB it should display as the same. I have used the code as below to check disk size in ansible playbook
- name: Get disk info
set_fact:
disk_size: "{{ item.value.size }}"
with_dict:
- "{{ ansible_facts['devices'] }}"
ignore_errors: yes
tags: get_disk_info
# - debug:
# msg: "{{ disk_size }}"
# ignore_errors: yes
# tags: get_disk_info
- debug:
msg: >
{% if disk_size > 10 %}
Disk Size {{ disk_size }} -> PASS
{% else %}
Disk Size {{ disk_size }} -> FAIL
{% endif %}
tags: get_disk_info
if the server has 55MB as disk size it also displaying the output as PASS, but as per above condition in the code it should display as FAIL..
please help me out in this playbook to get PASS if it should greater than 10GB in all the aspects