# Ansible hosts

**URL:** <https://forum.ansible.com/t/ansible-hosts/21014>\
**Category:** Ansible Developer\
**Created:** [March 30, 2016, 3:05am UTC](https://forum.ansible.com/t/ansible-hosts/21014 "2016-03-30T03:05:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anil](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@Anil](https://forum.ansible.com/u/Anil)\
**Post date:** [March 30, 2016, 3:05am UTC](https://forum.ansible.com/t/ansible-hosts/21014/1 "2016-03-30T03:05:46Z")

</div>

When I try playbook I see below error

ok: [[resoxapp-ch2f-01c.email.comcast.net](http://resoxapp-ch2f-01c.email.comcast.net)]

ERROR! the field ‘hosts’ is required but was not set

my inventory file

[hosts]

[resoxapp-ch2f-01c.email.comcast.net](http://resoxapp-ch2f-01c.email.comcast.net)

[resoxapp-ch2f-02c.email.comcast.net](http://resoxapp-ch2f-02c.email.comcast.net)

[resoxui-ch2f-02c.email.comcast.net](http://resoxui-ch2f-02c.email.comcast.net)

[resoxui-ch2f-01c.email.comcast.net](http://resoxui-ch2f-01c.email.comcast.net)

[reshaproxy-ch2f-21c.email.comcast.net](http://reshaproxy-ch2f-21c.email.comcast.net)

Below is the playbook

---

<div class="post-metadata">

**Author:** ![John\_Buxton](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@John\_Buxton](https://forum.ansible.com/u/John_Buxton)\
**Post date:** [March 30, 2016, 7:40pm UTC](https://forum.ansible.com/t/ansible-hosts/21014/2 "2016-03-30T19:40:55Z")

</div>

Your last line is wrong.  
“name” attribute must be within a tasks section.

You’ve put “name” at the same level as “hosts”; ansible-playbook is complaining because it is expecting to see “hosts” at that level.

P.S. This group is for Ansible Development discussions. I believe there’s a separate group for Ansible usage issues.

---

<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:47pm UTC](https://forum.ansible.com/t/ansible-hosts/21014/3 "2019-12-27T19:47:03Z")

</div>

I am getting the same 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:** ![Karol\_Czeryna](https://avatars.discourse-cdn.com/v4/letter/k/ed655f/32.png) [@Karol\_Czeryna](https://forum.ansible.com/u/Karol_Czeryna)\
**Post date:** [December 29, 2019, 4:00pm UTC](https://forum.ansible.com/t/ansible-hosts/21014/4 "2019-12-29T16:00:39Z")

</div>

Hi!

If you remove dash before `tasks` then playbook will run.  
What you have right now is another section which is missing hosts field.

Best,  
KC

---

<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 30, 2019, 4:02am UTC](https://forum.ansible.com/t/ansible-hosts/21014/5 "2019-12-30T04:02:17Z")

</div>

Thank you so much. Have we worked on cx\_oracle ansible module? I need some help on that.

Thanks  
Anand Solomon
