How to use Ansible with clients that have dynamic (DHCP) IPs?

Since Ansible is clientless, if say you were trying to manage Windows or Mac laptops that didn’t have fixed IPs (eg: DHCP clients), how do you solve this scenario?

Do you use Dynamic DNS (DDNS)?

Have others solved this - seems almost like you need a minor agent for registration but…

Thanks in advance.

That is a general issue with hosts that have dynamic addresses.
DDNS is one example of how to address that - this in fact is 'a minor
agent' as you call it.
There is no single solution, and it is not specific to ansible.

Dick

Thanks Dick - I get your point. That said, not that this is the direction I want to go at the moment, Puppet does have agents that slightly simplify this particular part of the problem.

Anyway, good to have confirmation that DDNS is on the right track.

Thanks again!

you can potentially create or search for a dynamic inventory script that can pull your addresses from whatever provides dhcp. You must have a list somewhere so check how you can pull that. You can also do a static inventory and do ranges. So for example, if your range of windows are in 192.168.50.1-192.168.50.200. Worse case scenario you can use an inventory that has all the ranges of IP and do tasks based on facts. There’s option but, you have to find what works for you.

Jonathan Lozada De La Matta on mobile

– 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 . To view this discussion on the web visit .

That’s certainly a possibility, though it starts to be a little impractical as you start to size out. Still, something to think about - thanks!

You also could use an automatc VPN client and the corresponding IP; this
also works for DHCP Clients that are leaving your network.
(relevant for homeoffices etc).

Ansible also have a "agent" ansible-pull run from crontab.

Thank you - very helpful!!!

Mean to respond to this earlier. Thank you - yes VPN is a possibility here as well.

Thanks again.