# Test on ansible facts sda size

**URL:** <https://forum.ansible.com/t/test-on-ansible-facts-sda-size/34120>\
**Category:** Ansible Project\
**Created:** [October 27, 2020, 7:47pm UTC](https://forum.ansible.com/t/test-on-ansible-facts-sda-size/34120 "2020-10-27T19:47:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bill\_Price](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@Bill\_Price](https://forum.ansible.com/u/Bill_Price)\
**Post date:** [October 27, 2020, 7:47pm UTC](https://forum.ansible.com/t/test-on-ansible-facts-sda-size/34120/1 "2020-10-27T19:47:27Z")

</div>

Can someone point me in the right direction

ansible\_devices[‘sda’][‘size’] returns “X GB”

How can I use a when statement to perform something

when: x\> variable

Do I need to convert “X GB” to a number

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [October 27, 2020, 8:17pm UTC](https://forum.ansible.com/t/test-on-ansible-facts-sda-size/34120/2 "2020-10-27T20:17:51Z")

</div>

> Can someone point me in the right direction
> 
> ansible\_devices['sda']['size'] returns "X GB"
> 
> How can I use a when statement to perform something
> 
> when: x\> variable
> 
> Do I need to convert "X GB" to a number

yes, to a float to be precise.

try something like this:

when: ansible\_devices['sda'].size.split(' ')[0]|float \> 18

---

<div class="post-metadata">

**Author:** ![Bill\_Price](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@Bill\_Price](https://forum.ansible.com/u/Bill_Price)\
**Post date:** [October 28, 2020, 12:34pm UTC](https://forum.ansible.com/t/test-on-ansible-facts-sda-size/34120/3 "2020-10-28T12:34:40Z")

</div>

Thanks, That works great
