Force ansible to use IPv4 / IPv6?

I’ve run into a minor problem where one of my hosts has an AAAA record for an address assigned via DHCP6, but it isn’t acquiring that address. I can connect via the IPv4 address just fine. I’m looking for a switch to tell ansible / ansible-playbook to force a connection over one protocol so I don’t have to come up with some lower-level hack, forget about it, and have it cause another problem tomorrow :slight_smile:

Off the top of my head:

  1. Do the IPv4 and IPv6 addresses have different hostnames in DNS? If so, use the hostname for the address that’s usable.
  2. In the ansible machine’s .ssh/config file, you can enter something like this:

HOST problem-hostname
AddressFamily inet

According to my man page for ssh_config, “inet” is IPv4 and “inet6” is IPv6.

-Greg

Should be able to do this with ssh-config.

Don’t forget to tell your client to fix their brain-dead DNS! :slight_smile: