Hi Michael,
First, thanks for reporting the bug. I’ve filed https://github.com/ansible/ansible/issues/5583 so feel free to add more details if you’d like. I’ll try and get a fix for an improved error message out soon.
I’ve seen the error “RSA key format is not supported” typically only when the keyfile has not been properly converted to RSA/PEM format. It’s likely redundant information, but just to be clear, the command I use to convert my key is:
$ openssl pkcs12 -in long-hash-keyname.p12 -nodes -nocerts | openssl rsa -out /path/to/converted.pem
When prompted for a password, the default is: notasecret
If I use ‘file’ on both, I see:
long-hash-keyname.p12: data
converted.pem: PEM RSA private key
Make sure you have the latest libcloud installed (pip install apache-libcloud==0.14.0-beta3).
Now, just so we can verify that the key is working and you can at least connect to GCE and extract host information, try this:
Checkout the latest ansible from source and set up the environment,
$ git clone https://github.com/ansible/ansible
$ cd ansible
$ . hacking/env-setup
Create a ‘secrets’ file in your home directory and set the proper values. Alternatively, you should be able to create this file in the PYTHONPATH defined when running “source hacking/env-setup”
$ cat $HOME/secrets.py
GCE_PARAMS = (‘long-hash@developer.gserviceaccount.com’, ‘/path/to/converted.pem’)
GCE_KEYWORD_PARAMS = {‘project’: ‘my_project_id’}
Edit the gce.ini file in the source tree, and set the ‘libcloud_secrets’ variable, the relevant parts for me look like,
$ cat plugins/inventory/gce.ini
[gce]
libcloud_secrets = /home/myusername
Now, you can set an environment variable for the inventory plugin,
$ export GCE_INI_PATH=$HOME/ansible/plugins/inventory/gce.ini
With all that in place, you can try to use the inventory plugin against an existing GCE instance just to see if all the auth stuff is working:
$ ansible/plugins/inventory/gce.py --host myinstance
And you’ll hopefully get back some json about that instance.