GCE Deploy new host

Hi,

I am trying to create a new host using the GCE module but I keep hitting the same user. The credentials I am using do have full access.

Playbook

  • name: Create instances
    hosts: localhost
    tasks:
  • name: Launch instances
    local_action: gce instance_names=dcom
    machine_type=n1-highcpu-2
    image=backports-debian-7-wheezy
    zone=europe-west1-b
    metadata=‘{“dc”:“gce”}’
    project_id=111111111
    pem_file=/opt/ansible/.keys/pkey.pem
    service_account_email=XXX@developer.gserviceaccount.com
    register: gce

Command run:

ansible-playbook -s -i plugins/inventory/gce.py manifest/master.yml

Error

PLAY [Create instances] *******************************************************

GATHERING FACTS ***************************************************************
ok: [localhost]

TASK: [Launch instances] ******************************************************
failed: [localhost] => {“changed”: false, “failed”: true}
msg: Missing required create instance variable

FATAL: all hosts have already failed – aborting

PLAY RECAP ********************************************************************

localhost : ok=1 changed=0 unreachable=0 failed=1

Any ideas or help would be appreciated.

Thanks

Mark

That’s a pretty terrible error message IMHO, can you file a bug on this (github.com/ansible/ansible) so we can report the actual parameter that is missing.

From reading the code:

These variables all have default values but check just in case

if not lc_image or not lc_network or not lc_machine_type or not lc_zone:
module.fail_json(msg=‘Missing required create instance variable’,
changed=False)


Appears to be one of those 4.   We should totally say which one errored it out though.


Feel free to flag me, @erjohnso to the issue so I can fix up the error messages on my next pass through the modules.

I’ve filed an issue in github to track this issue.

https://github.com/ansible/ansible/issues/8265

Thanks,
James