Access issues with Google Cloud Instances

Hi,

I an new to gce and trying to install ansible on a node and trying to ping another node. I am  using --ask-pass --ask-become-pass to exchage passwords (I am using same user and root password across all the nodes) but for some reason the above process is failing.

Can you please tell me where I am doing mistake


Triage: https://bitbucket.org/snippets/theputta/MeRdq5
  • post-author-pic
    Matthew U
    09-10-2018

    Is SSH/port 22 allowed between instances? Are you able to SSH from one instance to another? I was able to find an Ansible-specific issue/resolution to this error at the below link:



    Does one of the below solutions for the above link work for you assuming that port 22 is enabled between instances?

    "I have just found out the reason, I cannot connected.

    There was an error in my config file in .ssh folder which make the ssh go to a different router rather then the on-site one.

    I need to add ansible_ssh_pass=<mypassword> ansible_ssh_user=<myusername> next to the host IP in the /etc/ansible/hosts."

  • post-author-pic
    Aditya P
    09-11-2018

    user_294399_5b9765d44cd07.png_800.jpg
    1. Yes, i doublechecked firewall settings and it looks good.
    2. I tried to follow the other steps which where shown in the link, but no luck.
    3. I am sure that issue is with ssh (i couldnt ssh into other instance using ssh keys)
    4. Will update you, if I could resolve.
    Thanks again   @mulasien  @mattulasien 


  • post-author-pic
    Aditya P
    09-11-2018

    I also tried to enable root login on target host but dint work for me

    https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/v2v_guide/preparation_before_the_p2v_migration-enable_root_login_over_ssh

  • post-author-pic
    Ben L
    09-11-2018

    You mentioned that you're connect using a username/password. By default doesn't Google use SSH keys? 
    Did you make changes to the SSH settings?

    Just some things that I would try:

    1.) Verify that SSH works with SSH key (because this is the default)
    -> List off your instances to ensure you have the correct name.
    $ `gcloud compute instances list`
    -> Connect into the instance using gcloud
    $ `gcloud compute ssh linux-user-name@instance-name`
    -> NOTE: you can also add the --dry-run flag to view the SSH command being run.
    $ `gcloud compute ssh linux-user-name@instance-name --dry-run`

    If that doesn't work, you may have a broken SSH configuration. Start by undoing any changes and try again.
    If these work, then connecting via SSH works using an SSH key.
    You could upload your SSH key as project metadata.
    $ `gcloud compute project-info add-metadata --metadata-from-file ssh-keys=[LIST_PATH]`
    Then in Ansible you could set the path to your SSH key by setting the private_key_file property.

    If you need to use a username/password
    2.) Verify that SSH works with username/password
    -> List off your instances to ensure you have the correct name.
    $ `gcloud compute instances list`
    -> Using the external IP address from the list above, attempt to connect via ssh
    $ `ssh linux-user-name@instance-external-ip-address`

    If that doesn't work, the issue could be related to your username, password, or the SSH configuration.
    If it does work, the issue is likely with Ansible. At this point, try using the verbosity flags to view the commands being run, and see if maybe they're not being called correctly. If you can extact the command that Ansible is running, you can start debugging it.

    Ensure the IP address is set correctly. Being ephemeral, they can change.
    Ensure the module is trying to connect with username and password, and not via key.

    These sorts of issues can be tricky. One typo can break everything. I've been there! Keep ruling out issues one at a time. Good luck! :D

  • post-author-pic
    Aditya P
    09-13-2018

    Hi  @sowhelmed
    I am stuck at the first steps itself.
    Triage: https://bitbucket.org/snippets/theputta/4ebrp4

Looking For Team Training?

Learn More