Today I've needed an Ansible play which first tries to connect with A (e.g. 
port 22, user hello) and if that should fail, fall back to B (e.g. port 22, 
user world). I've started scripting and it all looked great until I've ran 
into a big problem: Whenever a SSH connection fails, Ansible throws a 
"fatal" instead of just an usual "failed", so "ignore_errors" does not help 
at all.

I now came up with my own solution, which involves a callback module: 
Whenever the environment variable *soft_connection_errors *is set within a 
task, SSH connections will fail and no longer throw any fatal errors. I've 
uploaded my code as a Gist: Ansible Connection Bootstrapper 
<https://gist.github.com/NeoXiD/269618ba001b51abb0d2>

Is there any better solution available? Runtime method patching just 
doesn't seem right to me, even if it perfectly works.

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a149fe69-3615-4269-88d6-e3aeb809af73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to