# ERROR! the field 'hosts' is required but was not set

**URL:** <https://forum.ansible.com/t/error-the-field-hosts-is-required-but-was-not-set/28988>\
**Category:** Ansible Project\
**Created:** [November 9, 2018, 10:37am UTC](https://forum.ansible.com/t/error-the-field-hosts-is-required-but-was-not-set/28988 "2018-11-09T10:37:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nexusbond.renz](https://avatars.discourse-cdn.com/v4/letter/n/e68b1a/32.png) [@nexusbond.renz](https://forum.ansible.com/u/nexusbond.renz)\
**Post date:** [November 9, 2018, 10:37am UTC](https://forum.ansible.com/t/error-the-field-hosts-is-required-but-was-not-set/28988/1 "2018-11-09T10:37:03Z")

</div>

> **(attachments)**
>
> ![1.JPG](https://us1.discourse-cdn.com/ansible/original/2X/e/eb35548e3d45350d9882e4b30762672e9f22a904.jpeg)

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [November 9, 2018, 4:31pm UTC](https://forum.ansible.com/t/error-the-field-hosts-is-required-but-was-not-set/28988/2 "2018-11-09T16:31:09Z")

</div>

The error comes all the way at the end, could it be that it’s not an error from that last task, but instead something else?  
Also, instead of using the ‘expect’ module, you could use ‘shell’ module and define some corresponding environment variables instead, which seem a little less fragile:

[https://github.com/margeson/ansible-iredmail/blob/master/roles/iredmail/tasks/install.yml#L25](https://github.com/margeson/ansible-iredmail/blob/master/roles/iredmail/tasks/install.yml#L25)

Dick

> **(attachments)**
>
> ![1.JPG](https://us1.discourse-cdn.com/ansible/original/2X/e/eb35548e3d45350d9882e4b30762672e9f22a904.jpeg)
