# Error while executed yml file

**URL:** <https://forum.ansible.com/t/error-while-executed-yml-file/30125>\
**Category:** Ansible Project\
**Created:** [April 16, 2019, 4:00pm UTC](https://forum.ansible.com/t/error-while-executed-yml-file/30125 "2019-04-16T16:00:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikram\_acharya](https://avatars.discourse-cdn.com/v4/letter/v/65b543/32.png) [@vikram\_acharya](https://forum.ansible.com/u/vikram_acharya)\
**Post date:** [April 16, 2019, 4:00pm UTC](https://forum.ansible.com/t/error-while-executed-yml-file/30125/1 "2019-04-16T16:00:03Z")

</div>

Hello Team

Am pretty new to Ansible trying , am getting an error while executing yml file .  
Here am trying to install httpd services on one of web server i have inventory file below are the details ip details added am able to ping all these IP

inventory file:

mintty screen dump

> `<br>[webserver] <br>172.31.17.222 <br> <br>[webserver:vars] <br>package_name=httpd <br> <br>[dbserver] <br>172.31.17.101 <br> <br>[local] <br>localhost <br>`  
>   
>   
> |
> 
> - |

mintty screen dump

> `<br>ansible@ip-172-31-18-96:/etc/playbook$ ansible -i inventory -m ping all <br>172.31.17.101 | SUCCESS => { <br> "changed": false, <br> "ping": "pong" <br>} <br>172.31.17.222 | SUCCESS => { <br> "changed": false, <br> "ping": "pong" <br>} <br>localhost | SUCCESS => { <br> "changed": false, <br> "ping": "pong" <br>`  
>   
>   
> |
> 
> - |

This is YMl file i have written :

---

<div class="post-metadata">

**Author:** ![vikram\_acharya](https://avatars.discourse-cdn.com/v4/letter/v/65b543/32.png) [@vikram\_acharya](https://forum.ansible.com/u/vikram_acharya)\
**Post date:** [April 16, 2019, 5:49pm UTC](https://forum.ansible.com/t/error-while-executed-yml-file/30125/2 "2019-04-16T17:49:23Z")

</div>

Hello Team

Can some one help me with my request please

Regards  
Vk

---

<div class="post-metadata">

**Author:** ![fahad.riaz1718](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@fahad.riaz1718](https://forum.ansible.com/u/fahad.riaz1718)\
**Post date:** [April 16, 2019, 8:36pm UTC](https://forum.ansible.com/t/error-while-executed-yml-file/30125/3 "2019-04-16T20:36:47Z")

</div>

try using this syntax and then execute your playbook.

---

<div class="post-metadata">

**Author:** ![vikram\_acharya](https://avatars.discourse-cdn.com/v4/letter/v/65b543/32.png) [@vikram\_acharya](https://forum.ansible.com/u/vikram_acharya)\
**Post date:** [April 17, 2019, 9:29am UTC](https://forum.ansible.com/t/error-while-executed-yml-file/30125/4 "2019-04-17T09:29:00Z")

</div>

Thank you Riaz it worked

Regards  
Vikram

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [April 18, 2019, 4:01pm UTC](https://forum.ansible.com/t/error-while-executed-yml-file/30125/5 "2019-04-18T16:01:21Z")

</div>

The sudo: has been deprecated for a long time and recently remove use  
`become: yes` instead
