# GCE module and private IP addresses

**URL:** <https://forum.ansible.com/t/gce-module-and-private-ip-addresses/21741>\
**Category:** Ansible Project\
**Created:** [June 11, 2016, 7:58am UTC](https://forum.ansible.com/t/gce-module-and-private-ip-addresses/21741 "2016-06-11T07:58:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abdul\_Jabbar\_Azam](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@Abdul\_Jabbar\_Azam](https://forum.ansible.com/u/Abdul_Jabbar_Azam)\
**Post date:** [June 11, 2016, 7:58am UTC](https://forum.ansible.com/t/gce-module-and-private-ip-addresses/21741/1 "2016-06-11T07:58:40Z")

</div>

Hello,

I’d like to add a private IP address when creating google gce instances. Looking at the docs this doesn’t seem to be possible. [http://docs.ansible.com/ansible/gce\_module.html](http://docs.ansible.com/ansible/gce_module.html). I am using version 2.1 from the source at github cloned using git a few weeks ago.

If I use the gloud SDK I can create the instance

gcloud compute --project “my-project” instances create “bootstrap” --zone “europe-west1-d” --machine-type “f1-micro” --subnet “default-6f68d4d6fabcb680” --private-network-ip “10.132.0.2” --metadata “block-project-ssh-keys=true” --maintenance-policy “MIGRATE” --scopes default=“[https://www.googleapis.com/auth/cloud-platform](https://www.googleapis.com/auth/cloud-platform)” --disk “name=docker-disk-for-instance-bootstrap,device-name=docker-disk-for-bootstrap,mode=rw,boot=no” --image “/centos-cloud/centos-7-v20160511” --boot-disk-size “10” --boot-disk-type “pd-standard” --boot-disk-device-name “bootstrap”

I need to create a few instances with static IP addresses because I’m trying to write an install script for DCOS on GCE and a number of the instances need a private static IP address.

Is there a way to add a private IP addresses to a google instance using the gce module or should I call the gcloud tool using the command module?

---

<div class="post-metadata">

**Author:** ![Jonathan\_Miller](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@Jonathan\_Miller](https://forum.ansible.com/u/Jonathan_Miller)\
**Post date:** [June 13, 2016, 8:13am UTC](https://forum.ansible.com/t/gce-module-and-private-ip-addresses/21741/2 "2016-06-13T08:13:20Z")

</div>

…sorry, not an answer to your ansible question, but in Google Cloud Platform you can use the instance name instead of an IP address and that will resolve to the instance, whatever its IP - so you may not need a static IP at all.

![](https://lh3.googleusercontent.com/-O_BhwkiBPC4/VAnKq6opisI/AAAAAAAAAZ4/Vm7O5YNtMTE/w975-h137-no/signature_final_2015-780.jpg)

Follow us on: [![](https://lh3.googleusercontent.com/-F6SOUlnCxMA/VAh6lUYygmI/AAAAAAAAAX8/RGnnsZ9Os70/s38-no/googleplus.png)](https://plus.google.com/+Appsbroker/)[![](https://lh5.googleusercontent.com/-ENtYeC0inGs/VAh6lsp7fjI/AAAAAAAAAYE/XnOjQ8CkUvA/s38-no/twitter.png)](https://twitter.com/appsbroker)[![](https://lh5.googleusercontent.com/-qntzbd-rp7k/VAh6lrlzY7I/AAAAAAAAAYA/J9kMb1WHg4o/s38-no/linkedin.png)](http://www.linkedin.com/company/appsbroker-consulting-limited/careers?trk=top_nav_careers)

Appsbroker Consulting Limited, Registered office: Appsbroker House, The Square, Swindon,

SN1 3EB, Company Number: 5702796, VAT Number: GB 876 3533 92, Company registered in England and Wales.

---

<div class="post-metadata">

**Author:** ![Tom\_Melendez](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@Tom\_Melendez](https://forum.ansible.com/u/Tom_Melendez)\
**Post date:** [June 13, 2016, 10:33pm UTC](https://forum.ansible.com/t/gce-module-and-private-ip-addresses/21741/3 "2016-06-13T22:33:48Z")

</div>

Hi Abdul,

It’s not currently supported but certainly something we could add. Mind raising an issue at [ansible/ansible-modules-core](https://github.com/ansible/ansible-modules-core/issues) so we can prioritize and get it added?

As for today, my feeling is that you could either gcloud command line tool, the [uri](http://docs.ansible.com/ansible/uri_module.html) module with the [GCE API](https://cloud.google.com/compute/docs/reference/latest/instances), or perhaps use new [subnetwork](https://github.com/ansible/ansible-modules-core/pull/3701) support with a small subnetwork (This won’t give you control over the IP, but does keep it in Ansible; minimum subnetwork size is /29).

Thanks,

Tom

---

<div class="post-metadata">

**Author:** ![Nathan\_Hammond](https://avatars.discourse-cdn.com/v4/letter/n/fbc32d/32.png) [@Nathan\_Hammond](https://forum.ansible.com/u/Nathan_Hammond)\
**Post date:** [August 28, 2017, 8:43pm UTC](https://forum.ansible.com/t/gce-module-and-private-ip-addresses/21741/4 "2017-08-28T20:43:31Z")

</div>

Are there any updates on this feature request? This is something that I need as well.

I don’t see that an issue was ever created, so I just submitted one here: [https://github.com/ansible/ansible/issues/28736](https://github.com/ansible/ansible/issues/28736)
