variable for server as entered in inventory

I have an inventory that contains (for example):

[servers]
1.2.3.4
1.2.3.5
1.2.3.6
server1.foo.bar
server2.foo.bar

I’d like to access the entry under servers as a {{ variable }} in a playbook, for each of the entries that are processed.

I’ve read the pages on ansible variables, but didn’t find anything that was a simple as what I’m looking for.

Can somebody point me appropriately?

Thanks,

Ed Greenberg

inventory_hostname has the name of the current host, so :

- hosts: servers
  tasks:
    - debug: var=inventory_hostname

should do what you want.