create network interface (ENI) on EC2 instance? possible to use "raw" boto commands?

478 views
Skip to first unread message

Jeff

unread,
Jan 2, 2015, 7:29:13 PM1/2/15
to ansible...@googlegroups.com
Someone asked for this a while back before the modules were reorganized, but I've seen no mention since, so I'm guess it's still not possible to create (or manipulate) an Elastic Network Interface (eni) on an EC2 instance yet.   That being the case, since this is supported by boto (create_network_interface), is it possible for me to make my own calls via boto somehow?  I'm not very deep into Ansible so perhaps this is a nonsensical question.

Thanks

Igor Cicimov

unread,
Jan 5, 2015, 5:37:10 PM1/5/15
to ansible...@googlegroups.com
+1 for this request. Have you seen this module though: https://github.com/cybosol/ansible/blob/master/library/cloud/ec2_eni
haven't tried it my self but maybe it can help.

Rob White

unread,
Apr 15, 2015, 3:52:19 AM4/15/15
to ansible...@googlegroups.com
Hi guys,

Recently had this requirement myself.


I'd appreciate testing / feedback and if all good I'll submit a PR to ansible-modules-extras

Thanks,

Tzach Livyatan

unread,
Apr 21, 2015, 5:23:23 AM4/21/15
to ansible...@googlegroups.com
Hi Rob
Thanks for module!
I was just looking for something like this.

One thing I'm missing is the ability to set the deleteOnTermination attribute to True.
Something like
connection.modify_network_interface_attribute(network_interface.id,'deleteOnTermination',True, attachment_id=network_interface.attachment.id)

Rob White

unread,
Apr 21, 2015, 8:25:31 AM4/21/15
to ansible...@googlegroups.com

Unfortunately you wouldn't be able to create the interface with this attribute. Boto doesn't support it. You'd have to create the interface and then immediately modify it.

Would this be acceptable?

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/-mFNN63kLrE/unsubscribe.
To unsubscribe from this group and all its topics, 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/11088c05-9f70-40fe-90c7-a7384bb18314%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tzach Livyatan

unread,
Apr 22, 2015, 3:46:37 AM4/22/15
to ansible...@googlegroups.com


On Tuesday, April 21, 2015 at 3:25:31 PM UTC+3, Rob White wrote:

Unfortunately you wouldn't be able to create the interface with this attribute. Boto doesn't support it. You'd have to create the interface and then immediately modify it.

Would this be acceptable?

Yes, this is what I'm doing now.

Rob White

unread,
Apr 22, 2015, 10:14:35 PM4/22/15
to ansible...@googlegroups.com
The latest commit has added support for delete_on_termination and source_destination_check.  Please test and let me know how it goes.

If you'd like to leave any comments regarding the module, there's a PR here https://github.com/ansible/ansible-modules-extras/pull/410

Rob White
Email: robwh...@gmail.com
Mobile (Australia): +61 410 700 733
Mobile (UK): +44 7527 895 226
Skype: robwhite83

Tzach Livyatan

unread,
Apr 26, 2015, 10:20:13 AM4/26/15
to ansible...@googlegroups.com


On Thursday, April 23, 2015 at 5:14:35 AM UTC+3, Rob White wrote:
The latest commit has added support for delete_on_termination and source_destination_check.  Please test and let me know how it goes.
Can you please give a full example of attaching an interface and setting the delete_on_termination?
Not sure how to extract the eni.interface.id for the second.

Should I use it as part of a local_action, like I do for ec2_tag?

Sorry for the naive questions, I'm relativity new to Ansible.

Rob White

unread,
Apr 26, 2015, 11:05:13 AM4/26/15
to ansible...@googlegroups.com

I assume you have referenced eni.interface.id because you've seen the example? Note the code above that which contains a register statement. This allows you to reference output from that command. See http://docs.ansible.com/playbooks_variables.html for more on that.

Once you've used that register command you can reference all the values of the ENI creation.

If you're still having issues, post your playbook as it stands and any errors you're getting.
 

Tzach Livyatan

unread,
Apr 27, 2015, 4:56:38 AM4/27/15
to ansible...@googlegroups.com


On Sunday, April 26, 2015 at 6:05:13 PM UTC+3, Rob White wrote:

I assume you have referenced eni.interface.id because you've seen the example? Note the code above that which contains a register statement. This allows you to reference output from that command. See http://docs.ansible.com/playbooks_variables.html for more on that.

Once you've used that register command you can reference all the values of the ENI creation.

If you're still having issues, post your playbook as it stands and any errors you're getting.

I had two issues, solve one:
- region parameter was missing, I set AWS_REGION to solve it.
Would it be nicer to have an explicit parameter for it, like ec2_tag have?
- subnet_id was missing, and I cant find an elegant way to get. For me having the instance subnet as a default will solve this problem.

Rob White

unread,
May 5, 2015, 6:19:07 AM5/5/15
to ansible...@googlegroups.com

The module does support region. You should be able to specify it without issue.

Can you get the subnet_id from the ec2_fact module?

Reply all
Reply to author
Forward
0 new messages