# getting ERROR: hosts declaration is required

**URL:** <https://forum.ansible.com/t/getting-error-hosts-declaration-is-required/15124>\
**Category:** Ansible Project\
**Created:** [April 30, 2014, 5:35pm UTC](https://forum.ansible.com/t/getting-error-hosts-declaration-is-required/15124 "2014-04-30T17:35:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas\_farah](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@thomas\_farah](https://forum.ansible.com/u/thomas_farah)\
**Post date:** [April 30, 2014, 5:35pm UTC](https://forum.ansible.com/t/getting-error-hosts-declaration-is-required/15124/1 "2014-04-30T17:35:16Z")

</div>

getting ERROR: hosts declaration is required  
and i have changed lineinfile: to action: lineinfile

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [May 1, 2014, 9:24pm UTC](https://forum.ansible.com/t/getting-error-hosts-declaration-is-required/15124/2 "2014-05-01T21:24:23Z")

</div>

Looks like your indentation in your playbook is off.

Also, name should be set per task, not as a task that is just called name.
