# any examples of ansible cfg's that allow use of gce dynamic inventory?

**URL:** <https://forum.ansible.com/t/any-examples-of-ansible-cfgs-that-allow-use-of-gce-dynamic-inventory/15315>\
**Category:** Ansible Project\
**Created:** [May 23, 2014, 1:18pm UTC](https://forum.ansible.com/t/any-examples-of-ansible-cfgs-that-allow-use-of-gce-dynamic-inventory/15315 "2014-05-23T13:18:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gallagher\_Polyn](https://avatars.discourse-cdn.com/v4/letter/g/94ad74/32.png) [@Gallagher\_Polyn](https://forum.ansible.com/u/Gallagher_Polyn)\
**Post date:** [May 23, 2014, 1:18pm UTC](https://forum.ansible.com/t/any-examples-of-ansible-cfgs-that-allow-use-of-gce-dynamic-inventory/15315/1 "2014-05-23T13:18:00Z")

</div>

Hiya,

I’m able to provision new GCE instances with ansible gce, but I can’t pass authentication when ansible pinging with dynamic GCE inventory script gce.py. I get “Permission denied (publickey).”

The gce.py script works fine, solo, so I figure changes may be required in ansible.cfg, but what?

Any tips or working configs for the gce modules?

Thanks, G

---

<div class="post-metadata">

**Author:** ![Gallagher\_Polyn](https://avatars.discourse-cdn.com/v4/letter/g/94ad74/32.png) [@Gallagher\_Polyn](https://forum.ansible.com/u/Gallagher_Polyn)\
**Post date:** [May 23, 2014, 9:42pm UTC](https://forum.ansible.com/t/any-examples-of-ansible-cfgs-that-allow-use-of-gce-dynamic-inventory/15315/2 "2014-05-23T21:42:10Z")

</div>

> The gce.py script works fine, solo, so I figure changes may be required in ansible.cfg, but what?

…ended up with this:

# file: ansible.cfg

[defaults]  
remote\_user= \<my\_gce\_user\_name\>  
[ssh\_connection]  
ssh\_args = -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -i some\_path\_to/google\_compute\_engine

…duplicated the SSH keys i’d generated to associate with my GCE account using the gcutil CLI – google\_compute\_engine and google\_compute\_engine.pub – those have to be on every additional client used…

…which setup works with something like the following:

GCE\_INI\_PATH=path\_to/gce.ini ansible all -i hosts/ -m setup

(Other new GCE users might well note there is no default root user access to GCE instances, so the remote\_user=your\_gce\_user\_name specification is key.)

G
