Hello,
I'm trying to use some ansible scripts that I've developed for a different environment and adapt them to the ansible-remote provisioner of packer.
One trick I used in those scripts is to set a remote port forwarding to ansible's ssh connection arguments for some tasks. This way I can, for example, temporarily forward the corporate proxy (which is accessible to the ansible runner, but it is not to the host being installed).
This is not working when launched by the ansible-remote provisioner and I'm not sure what is preventing it to work.
The error I see in the ansible verbose trace is:
debug1: remote forward failure for: listen 1234, connect mycorporate-proxy:8000
Warning: remote port forwarding failed for listen port 1234
I don't think this is a problem with the guest SSH configuration as running some simple ssh command to the NAT forwarded port for SSH that the builder sets up, the remote port forwarding setting succeeds.
Reading the documentation I seem to gather that some SSH server is brought up at the host to receive the connection attempts from ansible. Now, since I believe the guest SSHD accepts remote port forwarding, it might be a question that this host SSH server is the one that cannot accept the forwarding.
For what is worth, this is packer 1.2.4, with Ubuntu 18.04 as host and using the virtualbox-ovf builder
The questions are:
- Am I missing anything?
- Is there any configuration parameter controlling whether remote port forwarding is accepted?
- Would there be a way of using directly the guest SSHD without any intermediary? (I guess this would involve at least knowing the NATed SSH port set by the builder)
Thanks very much in advance and best regards
Julian