How to get a list of mount points from facts gathered by ansible on Linux host?

20 views
Skip to first unread message

Shibhikkiran D

unread,
Oct 21, 2018, 4:50:17 AM10/21/18
to Ansible Project
Hi Team: 

I'm trying to get a list variable with mount points from Ansible facts. But, I'm getting the whole "ansible_mounts" facts in JSON format. I have difficult time to retrieve only mount points in list format. 

Like below.

mount_points = ['/', '/boot', 'home', '/usr', '/var', '/tmp']

Please help. 

Thanks,
Shibhi

Kai Stian Olstad

unread,
Oct 21, 2018, 5:01:04 AM10/21/18
to ansible...@googlegroups.com
{{ ansible_mounts | map(attribute='mount') | list }}

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages