Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-26 Thread Shifa Shaikh
Thank you @Kai for the excellent explanation :) On Thursday, March 26, 2020 at 12:41:00 AM UTC+5:30, Kai Stian Olstad wrote: > > On Wed, Mar 25, 2020 at 09:54:07AM -0700, Shifa Shaikh wrote: > > @Kia Hi, > > > > As suggested I tried > > > > item.size_total instead of item.size_available > >

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread Kai Stian Olstad
On Wed, Mar 25, 2020 at 09:27:40PM +0200, patrick patra wrote: > hello everyone can someone help me with documentatiions on ansible network > automation > (routers,switches,..) > for example if i want to make a LAN then i want to deploy configurations > automatically with ansible playbooks > >

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread patrick patra
hello everyone can someone help me with documentatiions on ansible network automation (routers,switches,..) for example if i want to make a LAN then i want to deploy configurations automatically with ansible playbooks thanks to help me am just a biginner Le mer. 25 mars 2020 à 21:10, Kai Stian

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread Kai Stian Olstad
On Wed, Mar 25, 2020 at 09:54:07AM -0700, Shifa Shaikh wrote: > @Kia Hi, > > As suggested I tried > > item.size_total instead of item.size_available > > "{{ ansible_host }}_{{ item.mount }}: {{ (100 * ((item.size_total - > item.size_available) / item.size_total)) | round(1, 'common') }}" >

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread Dan Linder
I'd suggest putting a debug showing you the three numbers Ansible is using for item.size_total and item.size_available. As @klingac mentioned, it could be that the values that ""df -k" reports or uses in it's computation aren't the exact same ones that Ansible uses. For instance, using the

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread klingac
It could be this kind of problem http://linuxshellaccount.blogspot.com/2008/12/why-du-and-df-display-different-values.html `df` reads only and trusts completely to superblocks. Another reason could be, that you can have other running process that can keep a deleted file open. Do you have

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread Shifa Shaikh
@Kia Hi, As suggested I tried item.size_total instead of item.size_available "{{ ansible_host }}_{{ item.mount }}: {{ (100 * ((item.size_total - item.size_available) / item.size_total)) | round(1, 'common') }}" but it still gives me 22.2 % value instead of 19% Can you please let me

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread Kai Stian Olstad
On Wed, Mar 25, 2020 at 07:15:51AM -0700, Shifa Shaikh wrote: > > "{{ ansible_host }}_{{ item.mount }}: {{ (100 * ((item.size_total - > item.size_available) / item.size_available)) | round(1, 'common') }}" That is not how you calculate percentage, you need to divide on item.size_total and