delegate_to and ansible_host

55 views
Skip to first unread message

Vladimir-csp

unread,
Aug 7, 2017, 10:00:55 AM8/7/17
to Ansible Project
Hi all.
I have a problem with delegate_to.
I use a role which governs users, and it has a delegated task that gathers getent facts from a specific server, let's say 'getent-server'

Everything works fine until I try to apply this role to an unresolvable host, let's say 'ur-host' by using '--limit ur-host -e ansible_host=$ip_addr'. In this case delegation does not work, or rather task gets delegated to 'ur-host' itself instead of 'getent-server'. How can I make delegation work in these conditions?

Kai Stian Olstad

unread,
Aug 8, 2017, 9:06:00 AM8/8/17
to ansible...@googlegroups.com
All host need to exist in the inventory for Ansible to work, thats just
how Ansible works.

--
Kai Stian Olstad

Vladimir-csp

unread,
Aug 11, 2017, 8:37:37 AM8/11/17
to Ansible Project, ansible-pr...@olstad.com

All hosts are already in the inventory. The delegation breaks when ansible_host variable is given on the command line.
Reply all
Reply to author
Forward
0 new messages