I am trying to print the free space for a mount that an application needs
to have x free on. Once i can do that i would look at adding actions
based on that, but i would also like to the user running the play to know
if there is an issue or not.
Here is what i have so far, and i cant see to get what i would expect, any
thoughts:
code:
---
- hosts: all
tasks:
- debug:
msg: "Mount Point {{item.mount}} free space
{{item.size_available/1073741824}} "
loop: "{{ansible_mounts}}"
when: item.mount == '/home'
output:
PLAY [all]
**********************************************************************************************************************************************************
TASK [Gathering Facts]
**********************************************************************************************************************************************
ok: [server]
TASK [debug]
********************************************************************************************************************************************************
skipping: [server] => (item={u'block_used': 3056865, u'uuid':
u'bf9d7ab9-4be3-419d-8aed-f3b952b75957', u'size_total': 84408975360,
u'block_total': 20607660, u'mount': u'/', u'block_available': 17550795,
u'size_available': 71888056320, u'fstype': u'ext4', u'inode_total':
5242880, u'inode_available': 5165347, u'device':
u'/dev/mapper/VolGroup-lv_root', u'inode_used': 77533, u'block_size': 4096,
u'options': u'rw'})
skipping: [server] => (item={u'block_used': 109536, u'uuid':
u'11dcc8c1-6895-4cc5-b6f3-6d83767021ac', u'size_total': 499355648,
u'block_total': 487652, u'mount': u'/boot', u'block_available': 378116,
u'size_available': 387190784, u'fstype': u'ext4', u'inode_total': 128016,
u'inode_available': 127971, u'device': u'/dev/sda1', u'inode_used': 45,
u'block_size': 1024, u'options': u'rw'})
ok: [server] => (item={u'block_used': 3071894, u'uuid':
u'c6c79efc-1ada-4714-9d32-80a6cd896605', u'size_total': 105558474752,
u'block_total': 25771112, u'mount': u'/home', u'block_available': 22699218,
u'size_available': 92975996928, u'fstype': u'ext4', u'inode_total':
6540800, u'inode_available': 6382890, u'device':
u'/dev/mapper/VolGroup-lv_home', u'inode_used': 157910, u'block_size':
4096, u'options': u'rw'}) => {
"msg": "Mount Point /home free space 86.5906448364 "
}
What i really want to display and only display is : "Mount Point /home free
space 86.5906448364 "
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/218947b2-b36c-4ba6-bff8-6e2d5230eae0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.