vagrant-google icon indicating copy to clipboard operation
vagrant-google copied to clipboard

Support for GCE OS Login

Open rdhyee opened this issue 7 years ago • 5 comments

The current support for SSH offered by this provider makes use of adding SSH keys in GCE metadata. I'm inquiring about whether there's any interest in supporting the alternative way of accessing GCE instances: OS Login.

When I naively turned on OS Login, Vagrant was able to ssh into the instance but failed when trying to rsync with the instance. In my Vagrantfile, I had the configuration line

override.ssh.username = "raymond_yee_gmail_com"

to match the username key for the SSH key configured in OS Login

==> opencontext: Machine is ready for SSH access!
==> opencontext: Installing rsync to the VM...
==> opencontext: Rsyncing folder: /Users/raymondyee/C/src/open-context-py/sysadmin/ => /vagrant
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

find /vagrant '!' -type l -a '(' ! -user raymond_yee_gmail_com -or ! -group raymond_yee_gmail_com ')' -exec chown raymond_yee_gmail_com:raymond_yee_gmail_com '{}' +

Stdout from the command:



Stderr from the command:

find: ‘raymond_yee_gmail_com’ is not the name of an existing group


Apparently, it seems that the rsync action assumes that there would be a group with the same name as the username -- and this assumption is not correct when using OS Login.

rdhyee avatar Oct 08 '18 21:10 rdhyee

@rdhyee rsync is actually provided by the vagrant core module, so this may mean that we need to make a change in vagrant or at the very least pull POSIX names out of the Directory API (then a code change in fog is needed)

I'm not sure this is something I can change fairly quickly as I don't have a lot of cycles nowadays. However, I'd be happy to give pointers or review a PR if you're willing to take a crack at it.

Temikus avatar Oct 19 '18 03:10 Temikus

Google documentation steers people towards using OS Login: image

So, I think it is important to implement support for it. I ran into the same issue that was reported here, and if this issue is not resolved, that would prevent us from using vagrant.

@Temikus Could you outline in a bit more detail what needs to change in the vagrant core module and/or fog?

sryabkov avatar Apr 20 '19 10:04 sryabkov

The most interesting part that I discovered today is that it works with the same Vagrantfile in centos 7 and doesn't work in ubuntu 16 or ubuntu 18. All this was tested in GCP.

konstantin-recurly avatar Apr 21 '20 14:04 konstantin-recurly

Are there any plans to review this issue? it's very painful not to be able to use it with GCP and Ubuntu OS family.

konstantin-recurly avatar May 27 '20 20:05 konstantin-recurly

@konstantin-recurly As I said in https://github.com/mitchellh/vagrant-google/issues/208#issuecomment-431235513 this is a free time project and I don't have a lot of bandwith to implement this. However, if you'd like to contribute I'm happy to review PR's and give pointers.

Temikus avatar Jun 27 '20 01:06 Temikus