Skip to content

Commit 9a6a7bf

Browse files
committed
Add backstage templates
1 parent 8358d50 commit 9a6a7bf

File tree

3 files changed

+293
-0
lines changed

3 files changed

+293
-0
lines changed

extensions/patterns/configure_ec2/template_rhdh/configure_ec2.yml

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
apiVersion: scaffolder.backstage.io/v1beta3
2+
kind: Template
3+
metadata:
4+
name: cloud-configure-ec2
5+
title: AWS Operations / Create EC2 Instance
6+
description: This wizard will guide you on how to create EC2 instance in the Amazon cloud
7+
namespace: default
8+
tags:
9+
- aap-operations
10+
- intermediate
11+
- cloud-aws-ops
12+
- configure-ec2-pattern
13+
- create-ec2-instance
14+
spec:
15+
type: service
16+
parameters:
17+
- title: Prompts
18+
description: Create EC2 instance in the Amazon cloud
19+
required:
20+
- token
21+
- inventory
22+
properties:
23+
token:
24+
title: Token
25+
type: string
26+
description: Oauth2 token
27+
ui:field: AAPTokenField
28+
ui:widget: password
29+
ui:backstage:
30+
review:
31+
show: false
32+
inventory:
33+
title: Inventory
34+
description: Please enter the inventory you want to use the services on
35+
resource: inventories
36+
ui:field: AAPResourcePicker
37+
credentials:
38+
title: Credentials
39+
description: Select credentials for accessing the nodes this job will be ran
40+
against. You can only select one credential of each type. For
41+
machine credentials (SSH), checking "Prompt on launch" without
42+
selecting credentials will require you to select a machine
43+
credential at run time. If you select credentials and check "Prompt
44+
on launch", the selected credential(s) become the defaults that can
45+
be updated at run time.
46+
type: array
47+
ui:field: AAPResourcePicker
48+
resource: credentials
49+
verbosity:
50+
title: Verbosity
51+
description: Control the level of output Ansible will produce as the playbook executes.
52+
resource: verbosity
53+
ui:field: AAPResourcePicker
54+
- title: Survey
55+
required:
56+
- aws_region
57+
- instance_name
58+
- instance_type
59+
description: Create EC2 instance in the Amazon cloud
60+
properties:
61+
aws_region:
62+
title: AWS Region
63+
description: AWS region where resources should be created
64+
type: string
65+
ui:options:
66+
rows: 5
67+
instance_name:
68+
title: Instance Name
69+
description: Name of EC2 instance to create
70+
type: string
71+
ui:options:
72+
rows: 5
73+
instance_type:
74+
title: Instance Type
75+
description: Type of EC2 instance to create (e.g., t2.micro, m5.large)
76+
type: string
77+
ui:options:
78+
rows: 5
79+
ami_id:
80+
title: AMI ID
81+
description: Amazon Machine Image (AMI) ID to use for the instance, if not provided will default to the RHEL 9 AMI for the provided region and instance type
82+
type: string
83+
ui:options:
84+
rows: 5
85+
key_name:
86+
title: Key Pair Name
87+
description: Name of key pair to use or create for SSH access to the EC2 instance. Defaults to '{{ instance_name }}-key'
88+
type: string
89+
ui:options:
90+
rows: 5
91+
wait_for_state:
92+
title: Wait for State
93+
description: Whether to wait for the EC2 instance to be in the running state before continuing. Defaults to true
94+
type: string
95+
enum:
96+
- ""
97+
- 'true'
98+
- 'false'
99+
instance_tags:
100+
title: Instance Tags
101+
description: 'A dict of tags for the instance, e.g. {"environment: test", "owner": "team foobar"}'
102+
type: string
103+
ui:options:
104+
rows: 5
105+
vpc_name:
106+
title: VPC Name
107+
description: Name of the VPC to create. Defaults to '{{instance_name}}-vpc'
108+
type: string
109+
ui:options:
110+
rows: 5
111+
vpc_cidr:
112+
title: VPC CIDR Block
113+
description: CIDR block to use for the VPC being created. Defaults to 10.0.0.0/24
114+
type: string
115+
ui:options:
116+
rows: 5
117+
subnet_cidr:
118+
title: Subnet CIDR block
119+
description: CIDR block to use for the subnet being created. 10.0.0.0/25
120+
type: string
121+
ui:options:
122+
rows: 5
123+
sg_name:
124+
title: Security Group Name
125+
description: Name of the security group to create for securing traffic to the instance. Defaults to '{{ instance_name }}-sg'
126+
type: string
127+
ui:options:
128+
rows: 5
129+
sg_description:
130+
title: Security Group Description
131+
description: Description for the security group. Defaults to 'Security group for EC2 instance {{ instance_name }}'
132+
type: string
133+
ui:options:
134+
rows: 5
135+
sg_rules:
136+
title: Security Group Rules
137+
description: 'A list of security group rules in yaml format, e.g.: - proto: tcp ports: 80 cidr_ip: 0.0.0.0/0 Defaults to allowing SSH access from within the VPC'
138+
type: string
139+
ui:options:
140+
rows: 5
141+
ui:widget: textarea
142+
external_access:
143+
title: Create External Access Resources
144+
description: Whether to create resources for external access to the EC2 instance. Defaults to true. When true, adds security groups rules allowing inbound HTTP and HTTPS traffic, creates an internet gateway, creates a custom route table routing all internet traffic to the gateway, and allocates an elastic IP address for the instance.
145+
type: string
146+
enum:
147+
- ""
148+
- 'true'
149+
- 'false'
150+
151+
steps:
152+
- id: launch-job
153+
name: Launch AWS Operations / Create EC2 Instance
154+
action: rhaap:launch-job-template
155+
input:
156+
token: ${{ parameters.token }}
157+
values:
158+
inventory: ${{ parameters.inventory }}
159+
credentials: ${{ parameters.credentials }}
160+
verbosity: ${{parameters.verbosity}}
161+
extraVariables:
162+
aws_region: ${{ parameters.aws_region }}
163+
instance_name: ${{ parameters.instance_name }}
164+
instance_type: ${{ parameters.instance_type }}
165+
ami_id: ${{ parameters.ami_id }}
166+
key_name: ${{ parameters.key_name }}
167+
wait_for_state: ${{ parameters.wait_for_state }}
168+
instance_tags: ${{ parameters.instance_tags }}
169+
vpc_name: ${{ parameters.vpc_name }}
170+
vpc_cidr: ${{ parameters.vpc_cidr }}
171+
subnet_cidr: ${{ parameters.subnet_cidr }}
172+
sg_name: ${{ parameters.sg_name }}
173+
sg_description: ${{ parameters.sg_description }}
174+
sg_rules: ${{ parameters.sg_rules }}
175+
external_access: ${{ parameters.external_access }}
176+
output:
177+
text:
178+
- title: AWS Operations / Create EC2 Instance template executed
179+
successfully
180+
content: |
181+
**Job ID:** ${{ steps['launch-job'].output.data.id }}
182+
**Job STATUS:** ${{ steps['launch-job'].output.data.status }}
183+
links:
184+
- title: View in RH AAP
185+
url: ${{ steps['launch-job'].output.data.url }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
apiVersion: scaffolder.backstage.io/v1beta3
2+
kind: Template
3+
metadata:
4+
name: cloud-terminate-ec2
5+
title: AWS Operations / Terminate EC2 Instance
6+
description: This wizard will guide you on how to terminate EC2 instance in the Amazon cloud
7+
namespace: default
8+
tags:
9+
- aap-operations
10+
- intermediate
11+
- cloud-aws-ops
12+
- configure-ec2-pattern
13+
- terminate-ec2-instance
14+
spec:
15+
type: service
16+
parameters:
17+
- title: Prompts
18+
description: Terminate EC2 instance in the Amazon cloud
19+
required:
20+
- token
21+
- inventory
22+
properties:
23+
token:
24+
title: Token
25+
type: string
26+
description: Oauth2 token
27+
ui:field: AAPTokenField
28+
ui:widget: password
29+
ui:backstage:
30+
review:
31+
show: false
32+
inventory:
33+
title: Inventory
34+
description: Please enter the inventory you want to use the services on
35+
resource: inventories
36+
ui:field: AAPResourcePicker
37+
credentials:
38+
title: Credentials
39+
description: Select credentials for accessing the nodes this job will be ran
40+
against. You can only select one credential of each type. For
41+
machine credentials (SSH), checking "Prompt on launch" without
42+
selecting credentials will require you to select a machine
43+
credential at run time. If you select credentials and check "Prompt
44+
on launch", the selected credential(s) become the defaults that can
45+
be updated at run time.
46+
type: array
47+
ui:field: AAPResourcePicker
48+
resource: credentials
49+
verbosity:
50+
title: Verbosity
51+
description: Control the level of output Ansible will produce as the playbook executes.
52+
resource: verbosity
53+
ui:field: AAPResourcePicker
54+
- title: Survey
55+
required:
56+
- aws_region
57+
- instance_name
58+
description: Terminate EC2 instance in the Amazon cloud
59+
properties:
60+
aws_region:
61+
title: AWS Region
62+
description: AWS region where resources should be created
63+
type: string
64+
ui:options:
65+
rows: 5
66+
instance_name:
67+
title: Instance Name
68+
description: Name of EC2 instance to create
69+
type: string
70+
ui:options:
71+
rows: 5
72+
key_name:
73+
title: Key Pair Name
74+
description: Name of key pair to use or create for SSH access to the EC2 instance. Defaults to '{{ instance_name }}-key'
75+
type: string
76+
ui:options:
77+
rows: 5
78+
vpc_name:
79+
title: VPC Name
80+
description: Name of the VPC to create. Defaults to '{{instance_name}}-vpc'
81+
type: string
82+
ui:options:
83+
rows: 5
84+
steps:
85+
- id: launch-job
86+
name: Launch AWS Operations / Terminate EC2 Instance
87+
action: rhaap:launch-job-template
88+
input:
89+
token: ${{ parameters.token }}
90+
values:
91+
inventory: ${{ parameters.inventory }}
92+
credentials: ${{ parameters.credentials }}
93+
verbosity: ${{parameters.verbosity}}
94+
extraVariables:
95+
aws_region: ${{ parameters.aws_region }}
96+
instance_name: ${{ parameters.instance_name }}
97+
key_name: ${{ parameters.key_name }}
98+
vpc_name: ${{ parameters.vpc_name }}
99+
output:
100+
text:
101+
- title: AWS Operations / Terminate EC2 Instance template executed
102+
successfully
103+
content: |
104+
**Job ID:** ${{ steps['launch-job'].output.data.id }}
105+
**Job STATUS:** ${{ steps['launch-job'].output.data.status }}
106+
links:
107+
- title: View in RH AAP
108+
url: ${{ steps['launch-job'].output.data.url }}

0 commit comments

Comments
 (0)