From 6326975b45b827e1d3db6130c06a00ceec6dd44c Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Wed, 20 Nov 2024 11:30:04 -0500 Subject: [PATCH] Add experience --- .../experiences/configure_ec2/README.md | 0 .../configure_ec2/group_vars/all.yaml | 4 ++ .../playbooks/run_configure_ec2.yml | 28 +++++++++++++ .../experiences/configure_ec2/setup.yml | 41 +++++++++++++++++++ .../template_surveys/configure_ec2.yaml | 0 5 files changed, 73 insertions(+) create mode 100644 extensions/experiences/configure_ec2/README.md create mode 100644 extensions/experiences/configure_ec2/group_vars/all.yaml create mode 100644 extensions/experiences/configure_ec2/playbooks/run_configure_ec2.yml create mode 100644 extensions/experiences/configure_ec2/setup.yml create mode 100644 extensions/experiences/configure_ec2/template_surveys/configure_ec2.yaml diff --git a/extensions/experiences/configure_ec2/README.md b/extensions/experiences/configure_ec2/README.md new file mode 100644 index 00000000..e69de29b diff --git a/extensions/experiences/configure_ec2/group_vars/all.yaml b/extensions/experiences/configure_ec2/group_vars/all.yaml new file mode 100644 index 00000000..9f0638fa --- /dev/null +++ b/extensions/experiences/configure_ec2/group_vars/all.yaml @@ -0,0 +1,4 @@ +--- +organization: Default +# Github PAT +scm_credential: "UserGHPAT" diff --git a/extensions/experiences/configure_ec2/playbooks/run_configure_ec2.yml b/extensions/experiences/configure_ec2/playbooks/run_configure_ec2.yml new file mode 100644 index 00000000..e370eb63 --- /dev/null +++ b/extensions/experiences/configure_ec2/playbooks/run_configure_ec2.yml @@ -0,0 +1,28 @@ +--- +- name: Create AWS EC2 instance with the necessary network configurations + hosts: localhost + gather_facts: false + tasks: + - name: Configure Network resources + ansible.builtin.include_role: + name: cloud.aws_ops.ec2_networking_resources + vars: + ec2_networking_resources_vpc_name: "{{ vpc_name }}" + ec2_networking_resources_vpc_cidr_block: "{{ vpc_cidr }}" + ec2_networking_resources_subnet_cidr_block: "{{ subnet }}" + ec2_networking_resources_sg_internal_name: "{{ security_group_internal }}" + ec2_networking_resources_sg_internal_description: "{{ security_group_internal_description }}" + + - name: Configure AWS EC2 instance + ansible.builtin.include_role: + name: cloud.aws_ops.ec2_instance_create + vars: + ec2_instance_create_aws_region: "{{ region }}" + ec2_instance_create_instance_name: "{{ instance_name }}" + ec2_instance_create_instance_type: "{{ instance_type }}" + ec2_instance_create_ami_id: "{{ ami_id }}" + ec2_instance_create_vpc_subnet_id: subnet-071443aa123456789 + ec2_instance_create_tags: + Component: my-test-instance + Environment: Testing + ec2_instance_create_wait_for_boot: true diff --git a/extensions/experiences/configure_ec2/setup.yml b/extensions/experiences/configure_ec2/setup.yml new file mode 100644 index 00000000..1791d1f7 --- /dev/null +++ b/extensions/experiences/configure_ec2/setup.yml @@ -0,0 +1,41 @@ +--- +# Labels +# +controller_labels: + - name: cloud.aws_ops + organization: "{{ organization }}" + - name: confgiure_ec2_experience + organization: "{{ organization }}" + - name: run_configure_ec2 + organization: "{{ organization }}" + +# Projects +# +controller_projects: + - name: AWS Operations / Configure EC2 Experience Project + organization: "{{ organization }}" + scm_branch: main + scm_clean: 'no' + scm_delete_on_update: 'no' + scm_type: git + scm_update_on_launch: 'no' + scm_credential: "{{ scm_credential }}" + scm_url: https://github.com/GomathiselviS/cloud.aws_ops.git + + +# Job Templates +# +controller_templates: + - name: AWS Operations / Configure EC2 instance + description: This job template creates an EC2 instance with the necessary network infrastructure + project: AWS Operations / Configure EC2 Experience Project + playbook: extensions/experiences/configure_ec2/playbooks/run_configure_ec2.yaml + job_type: "run" + organization: "{{ organization | default('Default') }}" + labels: + - cloud.aws_ops + - configure_ec2_experience + - run_configure_ec2 + credentials: aws-instance + survey_enabled: true + survey_spec: "{{ lookup('file', experience.path.replace('setup.yml', '') + 'template_surveys/configure_ec2.yaml') | from_yaml }}" diff --git a/extensions/experiences/configure_ec2/template_surveys/configure_ec2.yaml b/extensions/experiences/configure_ec2/template_surveys/configure_ec2.yaml new file mode 100644 index 00000000..e69de29b