Skip to content

Commit

Permalink
Add experience for creating EC2 instance
Browse files Browse the repository at this point in the history
  • Loading branch information
gravesm committed Nov 22, 2024
1 parent 829bcf0 commit 22f38d6
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 0 deletions.
49 changes: 49 additions & 0 deletions extensions/experiences/ec2_instance_create/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Create EC2 Instance Experience

## Description

This experience is designed to help get an EC2 instance up and running.

## What This Experience Covers

### Project Templates

- **Create EC2 Instance Template**: Defined in `setup.yml`, this template helps organize and manage all necessary components for the ec2 creation experience. It ensures that relevant files, roles, and configurations are logically arranged, making it easier to maintain and execute automation tasks.

### Job Templates

- **Create EC2 Instance Job Template**: This template is designed to streamline the process of creating and EC2 instance.

### Playbooks

- **Playbooks**:

### Surveys

- **Create EC2 Instance Survey**: This survey provides an interactive way to specify parameters for creating the EC2 instance.

## Resources Created by This Experience

1. **Project Templates**
- Ensure that all relevant files, roles, and configurations are logically arranged, facilitating easier maintenance and execution of automation tasks.

2. **Job Templates**
- Outline the necessary parameters and configurations to perform network backups using the provided playbooks.

## How to Use

1. **Use Seed Red Hat Experience Job**
- Ensure the custom EE is correctly built and available in your Ansible Automation Platform. Execute the "Seed Red Hat Experience" job within the Ansible Automation Platform, and select the "AWS Operations" category to load this experience.

2. **Use the Job Templates**
- In the `Create EC2 Instance Automation Experience Project` execute the required job template to create the EC2 instance. Monitor the job execution and verify that the instance has been successfully created.

## Contribution

Contributions to this project are welcome. Please fork the repository, make your changes, and submit a pull request.

## License

GNU General Public License v3.0 or later.

See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text. This project is licensed under the MIT License. See the [LICENSE](https://github.com/redhat-cop/cloud.aws_ops/blob/main/LICENSE) file for details.
35 changes: 35 additions & 0 deletions extensions/experiences/ec2_instance_create/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---

controller_labels:
- name: cloud.aws_ops
organization: "{{ organization | default('Default') }}"
- name: ec2_instance_experience
organization: "{{ organization | default('Default') }}"
- name: create_ec2_instance
organization: "{{ organization | default('Default') }}"

controller_projects:
- name: AWS Operations / Create EC2 Instance
organization: "{{ organization | default('Default') }}"
scm_branch: main
scm_clean: no
scm_delete_on_update: no
scm_type: git
scp_update_on_launch: no
scm_url: https://github.com/redhat-cop/cloud.aws_ops.git

controller_templates:
- name: AWS Operations / Create EC2 Instance
description: This job template creates an EC2 instance.
ask_inventory_on_launch: true
ask_execution_environment_on_launch: true
project: AWS Operations / Create EC2 Instance
playbook: extensions/experiences/ec2_instance_create/create_ec2_instance.yml
job_type: run
organization: "{{ organization | default('Default') }}"
labels:
- cloud.aws_ops
- ec2_instance_experience
- create_ec2_instance
survey_enabled: true
survey_spec: "{{ lookup('file', experience.path.replace('setup.yml', '') + 'template_surveys/create_ec2_instance.yml') | from_yaml }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---

Check failure on line 1 in extensions/experiences/ec2_instance_create/template_surveys/create_ec2_instance.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

load-failure[runtimeerror]

Failed to load YAML file: extensions/experiences/ec2_instance_create/template_surveys/create_ec2_instance.yml
name: Create EC2 Instance Survey
description: Survey to configure the EC2 creation experience
spec:
- type: text
question_name: AWS Region
question_description: Name of AWS region to create instance in
variable: ec2_instance_create_aws_region
required: true

- type: text
question_name: Instance Name
question_description: Name of EC2 instance
variable: ec2_instance_create_instance_name:
required: true

- type: text
question_name: Instance Type
question_description: Type of EC2 instance (e.g., t2.micro, m5.large)
variable: ec2_instance_create_instance_type
required: true

- type: text
question_name: AMI ID
question_description: AMI ID for EC2 instance
variable: ec2_instance_create_ami_id
required: true

- type: text
question_name: Key Pair Name
question_description: Name of key pair to use for SSH access to the EC2 instance
variable: ec2_instance_create_key_name
required: true

- type: text
question_name: VPC Subnet ID
question_description: ID of subnet to launch EC2 instance in
variable: ec2_instance_create_vpc_subnet_id
required: true

- type: multiplechoice
question_name: Create Elastic IP
question_description: Whether to create and associate an Elastic IP with the instance
variable: ec2_instance_create_associate_eip
choices:
- true
- false
required: false
default: false

- type: multiplechoice
question_name: Create External Security Group
question_description: Whether to create and associate a security group for external access to the instance
variable: ec2_instance_create_associate_external_sg
choices:
- true
- false
required: false
default: false

- type: text
question_name: External Security Group Name
question_description: Name of the security group for external access to the instance
variable: ec2_instance_create_external_sg_name
required: false
default: ec2_instance_create-default-external-sg

- type: text
question_name: External Security Group Description
question_description: Description of the security group for external access to the instance
variable: ec2_instance_create_external_sg_description
required: false
default: Security group for external access

- type: multiplechoice
question_name: Create Internet Gateway
question_description: Whether to create and attach an internet gateway
variable: ec2_instance_create_associate_igw
choices:
- true
- false
required: false
default: false

0 comments on commit 22f38d6

Please sign in to comment.