# Separate Hard Disk guest

**URL:** <https://forum.ansible.com/t/separate-hard-disk-guest/30120>\
**Category:** Ansible Project\
**Created:** [April 16, 2019, 9:37am UTC](https://forum.ansible.com/t/separate-hard-disk-guest/30120 "2019-04-16T09:37:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lander.hernandezmart](https://avatars.discourse-cdn.com/v4/letter/l/8dc957/32.png) [@lander.hernandezmart](https://forum.ansible.com/u/lander.hernandezmart)\
**Post date:** [April 16, 2019, 9:37am UTC](https://forum.ansible.com/t/separate-hard-disk-guest/30120/1 "2019-04-16T09:37:12Z")

</div>

I need separate hard disk information in number of hard disk and his information. For example, I have 2 disk and only need 1 disk information.

**My YAML is:**

---

<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:** [April 16, 2019, 9:51am UTC](https://forum.ansible.com/t/separate-hard-disk-guest/30120/2 "2019-04-16T09:51:58Z")

</div>

If you're sure that you always want the first (i.e. index 0) item,  
then it should be as easy as:

&nbsp;&nbsp;&nbsp;- debug:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;msg: "{{disk\_facts.guest\_disk\_facts | first }}"

Alternatively you can use selectattr/map to filter out a specific  
entry, for instance based on the label or backing\_filename.

Dick

---

<div class="post-metadata">

**Author:** ![lander.hernandezmart](https://avatars.discourse-cdn.com/v4/letter/l/8dc957/32.png) [@lander.hernandezmart](https://forum.ansible.com/u/lander.hernandezmart)\
**Post date:** [April 16, 2019, 10:05am UTC](https://forum.ansible.com/t/separate-hard-disk-guest/30120/3 "2019-04-16T10:05:22Z")

</div>

When i’m use _{{disk\_facts.guest\_disk\_facts | first }}_ the result is:

ok: [host1] =\> {  
“msg”: “1”  
}
