0
    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?

  • 2
    Please provide more details. What does this code do? What is it for? Just posting code without information makes it very hard to help you. – sir_ian Jan 8 at 14:20
  • Change hard to impossible. – MatsK Jan 8 at 15:18
  • This code makes a tunnel between the private network and the machine that connects to bastion-host – Alexander SKyzZz Jan 8 at 15:49
  • Welcome to Raspberry Pi :-) Please take the short Tour and visit the Help Center to see how things work here. – Ingo Jan 8 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.