Okay - I know this is awful and edgecase-y but I'm going to try to
make it seem like it is not:
1. I'd like to be able to allow retries. So that if you get a failure
in some task it can try again. Either due to the task failing or due to
your connection failing. I know it's sticky - but I think kinda do-able
and it might help people on crappy connections.
2. Is there any way to have ansible have more than one ip for a single
host. I'd like to be able support an alternative route. I know this is
ridiculously edgecase-y but I thought it might be worth a shot. The
case is I have 2 routes - one via public ip, one via vpn. If I have a
choice I want to use the vpn, but if the vpn isn't up yet (b/c ansible
hasn't touched the system, yet :)) I want to use the other public ip.
I haven't started looking at the code I was just thinking about whether
or not this is even interesting.
thoughts?
-sv
hmm, like this?
1) a 'attempts' property for the connection plugins (default 1).
Does this exist? did i just miss it?
2) ansible_ssh_host and host name resolution taking a 'list' instead
of just 1 value, iterating over the list until it succeeds
* I currently use external/internal DNS servers to achieve this, VPN
server gives me the diff IP for the same host, diff hosts files might
also work (hosts, hosts_vpn) but it is a manual selection.
right - It would need to be a list - I'd put the vpn first - if that
doesn't connect - use the public.
I really want to refer to the host by a single hostname but connect to
it via ansible by the better option.
-sv
I could really use this. In my use case, I'm using Ansible to manage some
instances inside of an OpenStack cloud. With the version of OpenStack I'm
running, I can't access the instances from floating IPs if I'm inside of
another OpenStack instances, and I can only access the instance from
floating IPs if I'm outside of the instances.
Being able to specify both IPs and have ansible use the first one that
works would be wonderful.
Lorin
Hi Seth,
I really want to refer to the host by a single hostname but connect to
it via ansible by the better option.
You may have considered it already, but if the public IP of the host is
reachable over the VPN as well, you could add a static route over the VPN path
when it's up.
If the public IP isn't routable over the VPN, you could use iptables
DNAT to rewrite:
iptables -t nat -A OUTPUT -d <ext_ip> -p 22 -j DNAT --to-destination <vpn_ip>
Chris
@Seth,
no it doesn’t exist, just throwing out there possible implementations
So I’ve already talked a little bit about wanting to do very basic retires on a task by task basis, but connection level retries would be different, and likely need to be implemented in the connection plugin.
If you want to take a shot at it, it might be reasonably self contained.
It is also true that maybe a comma seperated list of hostnames could be handled there as well, but I’m not positive.
I think the real question here is can it be done in a way that keeps the code mostly maintainable, and then there’s a BIT an issue with that needing to be done for all connection plugins.
So really it seems like it needs to be done in a layer right above the connection plugin, like connection.py
I’ve searched the group a little and can’t find this discussion. Also don’t see anything in the docs. Is it possible to config a particular task to automatically retry N times on failure? I have a use case where it would be extremely useful (deploying a monitoring agent using the vendor’s deploy script which fails % of the time from random issues like HTTP connections to the master monitoring server where it downloads bits).
-Jeremy