# print volume group with highest number

**URL:** <https://forum.ansible.com/t/print-volume-group-with-highest-number/33206>\
**Category:** Ansible Developer\
**Tags:** ansible-devel\
**Created:** [June 17, 2020, 10:25pm UTC](https://forum.ansible.com/t/print-volume-group-with-highest-number/33206 "2020-06-17T22:25:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [June 17, 2020, 10:25pm UTC](https://forum.ansible.com/t/print-volume-group-with-highest-number/33206/1 "2020-06-17T22:25:44Z")

</div>

Something like this will sort the keys and use the last one.

- debug: msg={{ansible\_lvm.vgs[(ansible\_lvm.vgs.keys()|sorted|list)[-1]]}}
