# Need Help with writing ansible playbook

**URL:** <https://forum.ansible.com/t/need-help-with-writing-ansible-playbook/25788>\
**Category:** Ansible Project\
**Created:** [October 20, 2017, 4:19am UTC](https://forum.ansible.com/t/need-help-with-writing-ansible-playbook/25788 "2017-10-20T04:19:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![user56](https://avatars.discourse-cdn.com/v4/letter/u/f05b48/32.png) [@user56](https://forum.ansible.com/u/user56)\
**Post date:** [October 20, 2017, 4:19am UTC](https://forum.ansible.com/t/need-help-with-writing-ansible-playbook/25788/1 "2017-10-20T04:19:08Z")

</div>

Hello guys i have a really little experience working with ansible, but today my boss told me that i should write ansible playbook for checking disk space in the production machines  
we have a 15 machines and i want to enter each of them, then execute the ‘df -h’ command, then send output to the email.  
can you give me a template of this playook? like this  
host   
command \<df -h\>  
SendToEmail \<emails…\>  
thank you and have a nice day!

---

<div class="post-metadata">

**Author:** ![Ken\_Jenney](https://avatars.discourse-cdn.com/v4/letter/k/c2a13f/32.png) [@Ken\_Jenney](https://forum.ansible.com/u/Ken_Jenney)\
**Post date:** [October 20, 2017, 5:11am UTC](https://forum.ansible.com/t/need-help-with-writing-ansible-playbook/25788/2 "2017-10-20T05:11:08Z")

</div>

I think you’re overthinking it. If you need a script to regularly get disk utilization ansible is overkill at best. You could use pssh to accomplish the same thing. The email part of this is a separate beast altogether.

````auto
ansible all -i inventory/your-machines -a "df -h" > output.txt
mailx -a output.txt -s "Disk Report" user@domain.com```
If you really wanted to waste your time you could include mailx in a playbook as a local_action.
````
