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

Add new ec2_instance_create role #123

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

mandar242
Copy link
Contributor

This adds a new role to create a ec2 instance with customizable configuration.
See: https://issues.redhat.com/browse/ACA-1959

roles/ec2_instance_create/README.md Outdated Show resolved Hide resolved
roles/ec2_instance_create/README.md Outdated Show resolved Hide resolved
roles/ec2_instance_create/README.md Outdated Show resolved Hide resolved
roles/ec2_instance_create/README.md Outdated Show resolved Hide resolved
roles/ec2_instance_create/README.md Outdated Show resolved Hide resolved
roles/ec2_instance_create/README.md Outdated Show resolved Hide resolved
roles/ec2_instance_create/README.md Outdated Show resolved Hide resolved
roles/ec2_instance_create/README.md Outdated Show resolved Hide resolved
roles/ec2_instance_create/defaults/main.yml Show resolved Hide resolved
roles/ec2_instance_create/README.md Show resolved Hide resolved
@mandar242 mandar242 marked this pull request as ready for review November 21, 2024 02:21
roles/ec2_instance_create/README.md Show resolved Hide resolved
roles/ec2_instance_create/tasks/main.yml Outdated Show resolved Hide resolved
roles/ec2_instance_create/tasks/main.yml Outdated Show resolved Hide resolved
roles/ec2_instance_create/tasks/main.yml Outdated Show resolved Hide resolved
roles/ec2_instance_create/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@alinabuzachis alinabuzachis left a comment

Choose a reason for hiding this comment

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

Since we are here, shouldn't we also provide a playbook for this role?

roles/ec2_instance_create/README.md Outdated Show resolved Hide resolved
roles/ec2_instance_create/README.md Outdated Show resolved Hide resolved
roles/ec2_instance_create/README.md Outdated Show resolved Hide resolved
roles/ec2_instance_create/defaults/main.yml Outdated Show resolved Hide resolved
roles/ec2_instance_create/meta/argument_specs.yml Outdated Show resolved Hide resolved
roles/ec2_instance_create/README.md Outdated Show resolved Hide resolved
roles/ec2_instance_create/README.md Outdated Show resolved Hide resolved
* **ec2_instance_create_ami_id**: (Required)
The AMI ID for the EC2 instance.

* **ec2_instance_create_key_name**: (Required)
Copy link
Contributor

Choose a reason for hiding this comment

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

Even if it is stated in the ticket that the key name should be required this should be set as optional for 2 reasons:

  • sometimes user may need to create an instance without accessing it via SSH
  • In the case the role creates the key name we need to save the public key somewhere in order for the user to be able to connect to the instance

The name of the key pair to use for SSH access to the EC2 instance.
If the key does not exist, a key pair will be created with the name.

* **ec2_instance_create_vpc_subnet_id**: (Required)
Copy link
Contributor

Choose a reason for hiding this comment

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

This parameter can be also optional as the instance can be created in the default subnet id if it exists


#### Elastic IP

* **ec2_instance_create_vpc_id**: (Optional)
Copy link
Contributor

Choose a reason for hiding this comment

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

This parameter can be removed as the role can determine the VPC id from the ec2_instance_create_vpc_subnet_id parameter or the default vpc id


#### External Security Group

* **ec2_instance_create_external_sg_name**: (Required)
Copy link
Contributor

Choose a reason for hiding this comment

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

we do not really need external in the name of the security group variables


### Role Operation

* **ec2_instance_create_operation**: (Optional)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be replaced by the instance state with the values: present, running...

required: false
type: str
default: create
choices: [create, delete]
Copy link
Contributor

Choose a reason for hiding this comment

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

if it supports value create and delete, the role must be renamed

region: "{{ ec2_instance_create_aws_region }}"
filters:
tag:Name: "{{ ec2_instance_create_instance_name }}"
instance-state-name: ["running"]
Copy link
Contributor

Choose a reason for hiding this comment

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

We cannot filter on state running because this is valid only if the user waits for the instance to boot

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

Successfully merging this pull request may close these issues.

6 participants