ip_bastion_host=`tail -n +2 file | awk '($6) {print $5};'`
vpc=10.0.*
echo """
Host $ip_bastion_host
User $ssh_name
IdentityFile ~/.ssh/gcloudssh
Host 10.0.*
User $ssh_name
IdentityFile ~/.ssh/gcloudssh
ProxyCommand ssh $ssh_name@$ip_bastion_host -W %h:%p
""" > ./ssh.cfg
...
ssh -F ./ssh.cfg $ssh_name@$ip_bastion_host uptime - ok
ansible-playbook kubernetes/ansible/journal -i kubernetes/ansible/inventory
> TASK [Gathering Facts] *********************************************************
fatal: [master]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: connect to host 10.0.0.3 port 22: No route to host\r\n", "unreachable": true}
fatal: [node0]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: connect to host 10.0.0.2 port 22: No route to host\r\n", "unreachable": true}
This code makes a tunnel between the private network and the machine that connects to bastion-host.
It doesn't work?