inventory_hostname has the name of the current host, so : - hosts: servers tasks: - debug: var=inventory_hostname
should do what you want. -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8%3DUSi16NBR%3DmiAp%3DMxakM%2BUcPAGuPtSEKJ3P39yncr0jQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.