This thread is filled with red flags, and im not even talking about the fact that he's using ansible for monitoring....
On Monday, March 12, 2018 at 2:27:05 PM UTC+5:30, Jean-Yves LENHOF wrote: > > > > Le 08/03/2018 à 05:43, Kiran Shrimali a écrit : > > Hi, > > I am tryig to write an Ansible script which will Generat Alert on Disk > Usage. Once the Disk Usage goes above the Threshold, alert will be > generated. > > Below is start up code. > > --- > - hosts: "{{ hostGroup }}" > user: gamesroot > become: true > become_user: root > gather_facts: no > tasks: > - shell: df -h "{{ item }}" | tail -n 1 | awk {'print $5 '} | sed > 's/%//g' > with_items: > - / > - /home > - /backup > register: test > > - debug: > msg: "{{ test.results|map(attribute='stdout')|list }}" > - name: Size is big > shell: echo "tobig size " > when: test.results > 20 > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~` > > > Why not using ansible_mounts fact instead of running df ? Shell task > should be avoided each time it is possible ! > It already has information about FS > > Regards, > > JYL > -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/178a67ff-f585-4e5c-ab58-60eff81a0f21%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.