# 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/31877>\
**Category:** Ansible Developer\
**Created:** [December 27, 2019, 7:48pm UTC](https://forum.ansible.com/t/error-the-field-hosts-is-required-but-was-not-set/31877 "2019-12-27T19:48:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anand\_Solomon](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@Anand\_Solomon](https://forum.ansible.com/u/Anand_Solomon)\
**Post date:** [December 27, 2019, 7:48pm UTC](https://forum.ansible.com/t/error-the-field-hosts-is-required-but-was-not-set/31877/1 "2019-12-27T19:48:45Z")

</div>

I am getting the “ERROR! the field ‘hosts’ is required but was not set” error, and my playbook is as follows. I am trying to run a sql script (record.sql) from the ansible control server to the DB server.

---

<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:** [January 2, 2020, 5:12pm UTC](https://forum.ansible.com/t/error-the-field-hosts-is-required-but-was-not-set/31877/2 "2020-01-02T17:12:53Z")

</div>

remove the - in front of tasks, it is 'starting a new play' and that  
one is missing 'hosts:'

also this is more of a question for ansible-project.
