It is necessary to reduce the water connection parameters for the ansible - so that it is universal. There is an ssh config for 2 gates:

gate_1

Host 10.20.30.40 Hostname %h User centos ForwardAgent yes ProxyCommand ssh user@111.222.333.444 -W %h:%p

gate_2

Host 10.30.40.50 Hostname %h User centos ForwardAgent yes ProxyCommand ssh user2@222.333.444.555 -W %h:%p

How to add to the command connection for ansible - in the connection string - the second gate? ansible_ssh_user=centos ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q user@111.222.333.444"'

    1 answer 1

    In fresh SSH clients, there is -J to specify jump-host:

     [myhosts] host ansible_user=centos ansible_host=XXXX ansible_ssh_common_args="-J user1@1.1.1.1,user2@2.2.2.2" 
    • It is possible that you are right! But I did not start. Apparently not too new client) UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: unknown option -- J\r\nusage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]\n [-D [bind_address:]port] [-E log_file] [-e escape_char]\n} UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: unknown option -- J\r\nusage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]\n [-D [bind_address:]port] [-E log_file] [-e escape_char]\n} - Dofri
    • Judging by the release notes supported with OpenSSH 7.2 . - Konstantin Suvorov
    • I have OpenSSH_7.2p2 - apparently I need it even newer - Dofri
    • @Dofri I think you are running on Debian / Ubuntu in RHL / Fedora have this key in the OpenSSH package - Hellseher