Ansible hosts

When I try playbook I see below error

ok: [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

resoxapp-ch2f-02c.email.comcast.net

resoxui-ch2f-02c.email.comcast.net

resoxui-ch2f-01c.email.comcast.net

reshaproxy-ch2f-21c.email.comcast.net

Below is the playbook

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.

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.

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

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

Thanks
Anand Solomon