Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds vpc_id to ec2_group, from subnet facts, and allows to specify SG ip cidr #2405

Merged
merged 1 commit into from
Oct 25, 2019
Merged

Adds vpc_id to ec2_group, from subnet facts, and allows to specify SG ip cidr #2405

merged 1 commit into from
Oct 25, 2019

Conversation

retpolanne
Copy link
Contributor

How to use it

VPC ID

  • Create role using EC2 driver: molecule init role -r test-ec2 -d ec2
  • Include vpc_subnet_id to your platform on molecule.yml

IP CIDR

  • Create role using EC2 driver: `molecule init role -r test-ec2 -d ec2
  • Either include allowed_ip_cidr to the platforms (to specify a CIDR) or auto_public_ip (to make it use your current public IP). If you include none of these, the default will be 0.0.0.0/0.

Signed-off-by: Vinicyus Macedo <7549205+vinicyusmacedo@users.noreply.github.com>
Copy link
Contributor

@decentral1se decentral1se left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks fine to me but I can't test it and I don't use the driver personally.

Can anyone else comment?

Also, it would be AWESOME if you have time/energy to consider migrating the driver itself out into a plugin over at https://github.com/pycontribs/molecule-ec2. We are working towards a pluggable architecture in Molecule 3.0 and need people using the drivers to step up for this. No pressure 😅

@retpolanne
Copy link
Contributor Author

It would be really awesome to do it. I'm willing to help :)

@ssbarnea ssbarnea merged commit c4c07a8 into ansible:master Oct 25, 2019
@retpolanne
Copy link
Contributor Author

Thanks @ssbarnea

@retpolanne retpolanne deleted the ec2-group-should-attach-to-vpc branch October 25, 2019 19:53
@ssbarnea
Copy link
Member

@vinicyusmacedo Don't be too happy about it, removal comes after but I wanted to avoid having you recreate the patch on the new repository. I am relying on your help testing the plugin once I initialize the new repository.

@decentral1se
Copy link
Contributor

Also, come chat with us on IRC if you are not already there and we organise ourselves to get this done!

@retpolanne
Copy link
Contributor Author

@decentral1se joined.

- name: Create security group
ec2_group:
name: "{{ security_group_name }}"
description: "{{ security_group_name }}"
rules: "{{ security_group_rules }}"
rules_egress: "{{ security_group_rules_egress }}"
vpc_id: "{{ subnet_facts.vpc_id }}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ssbarnea I found a bug in here: it should iterate through subnet_facts. Should I keep doing patches on this repo or leave it to molecule-ec2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants