GCE module and private IP addresses

419 views
Skip to first unread message

Abdul Jabbar Azam

unread,
Jun 12, 2016, 10:46:22 PM6/12/16
to Ansible Project
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. 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" --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?

Jonathan Miller

unread,
Jun 13, 2016, 4:13:31 AM6/13/16
to Ansible Project
...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.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/244fbeb3-adde-4969-a816-bf798d2740c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jonathan Miller
Senior DevOps & Big Data Engineer, Appsbroker Consulting
Mob: 07580 779841


Follow us on:    


Appsbroker Consulting Limited, Registered office: Appsbroker House, The Square, Swindon,
SN1 3EB, Company Number: 5702796, VAT Number: GB 876 3533 92Company registered in England and Wales.
________________________________________
PLEASE NOTE AS RECIPIENT OF THIS EMAIL: Any views or opinions presented are solely those of the author and do not represent those of Appsbroker Consulting Limited. This e-mail is confidential and intended solely for the addressee. If you are not the intended recipient, be advised that you have received this mail in error and that any use, dissemination, forwarding, printing or copying of this e-mail is strictly prohibited. Furthermore, if you are not the intended recipient, please email it back to the sender and then immediately permanently delete it.

Tom Melendez

unread,
Jun 13, 2016, 8:43:02 PM6/13/16
to Ansible Project
Hi Abdul,

It's not currently supported but certainly something we could add.  Mind raising an issue at ansible/ansible-modules-core so we can prioritize and get it added?

As for today, my feeling is that you could either gcloud command line tool, the uri module with the GCE API, or perhaps use new subnetwork 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

Nathan Hammond

unread,
Aug 28, 2017, 4:43:31 PM8/28/17
to Ansible Project
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
Reply all
Reply to author
Forward
0 new messages