Merge pull request #19 from davidrojas25/master
AWS Provision VM done with new public_cloud method
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,4 +3,5 @@ sean_login_info.yml
|
||||
.DS_Store
|
||||
choose_demo.yml
|
||||
choose_demo_example_azure.yml
|
||||
choose_demo_example_aws.yml
|
||||
.ansible.cfg
|
||||
|
||||
@@ -14,11 +14,16 @@ my_tower_password: mahalo
|
||||
my_tower_host: test.rhdemo.io
|
||||
workshop_type: rhel
|
||||
|
||||
# leave as false unless you are deploying an Azure Demo
|
||||
azure_demo: False
|
||||
#only uncomment these and supply values for setting up an Azure Cloud Demo which means azure_demo: True above
|
||||
#my_subscription:
|
||||
#my_tenant:
|
||||
#my_client:
|
||||
#my_secret:
|
||||
# leave as comments unless you are deploying an public cloud Demo. Possible values are aws or azure
|
||||
public_cloud: none
|
||||
#only uncomment these and supply values for setting up an Azure Cloud Demo which means public_cloud: azure above
|
||||
#these value below are fake sample values only
|
||||
#my_subscription: bb66f723-9eb9-405b-7889-2e722a5a5a45
|
||||
#my_tenant: bbe51e50-8759-5cc6-93f7-71985d8dbddf
|
||||
#my_client: 7e7d5fd3-c84b-b64c-ae96-cf474f4aa573
|
||||
#my_secret: K1S5~EqpmvG68i8ni9-b1hmn3~yROfHM_I
|
||||
#only uncomment these and supply values for setting up an AWS Cloud Demo which means public_cloud: aws above
|
||||
#these value below are fake sample values only
|
||||
#my_access_key: kwjewk4h54jker
|
||||
#my_secret_key: wnwrl4nwwrh6srwo4rwher4
|
||||
|
||||
|
||||
33
choose_demo_example_aws.yml
Normal file
33
choose_demo_example_aws.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
## example file for how to choose a demo
|
||||
## chose specific demo or choose all
|
||||
|
||||
# SPECIFIC - example that installs just the deploy_application job template
|
||||
demo: aws_provision_vm
|
||||
|
||||
# ALL - example that installs all demos
|
||||
# demo: all
|
||||
|
||||
## Ansible Tower login infomation
|
||||
my_tower_username: student1
|
||||
my_tower_password: TnSynS1Re31ZAF
|
||||
my_tower_host: student1.cb8b.open.redhat.com
|
||||
workshop_type: windows
|
||||
|
||||
# leave as comments unless you are deploying an public cloud Demo
|
||||
public_cloud: aws
|
||||
#only uncomment these and supply values for setting up an Azure Cloud Demo which means public_cloud: azure above
|
||||
#these value below are fake sample values only
|
||||
#my_subscription: bb66f723-9eb9-405b-7889-2e722a5a5a45
|
||||
#my_tenant: bbe51e50-8759-5cc6-93f7-71985d8dbddf
|
||||
#my_client: 7e7d5fd3-c84b-b64c-ae96-cf474f4aa573
|
||||
#my_secret: K1S5~EqpmvG68i8ni9-b1hmn3~yROfHM_I
|
||||
#only uncomment these and supply values for setting up an AWS Cloud Demo which means public_cloud: aws above
|
||||
#these value below are fake sample values only
|
||||
my_access_key: 345IAJUNULTMIXFDSDFGF
|
||||
my_secret_key: 567BqE+YAH7DFG4RGSSDFG5SGDFGSDGF4
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -14,13 +14,18 @@ my_tower_password: zapata
|
||||
my_tower_host: test.rhdemo.io
|
||||
workshop_type: windows
|
||||
|
||||
# leave as false unless you are deploying an Azure Demo
|
||||
azure_demo: True
|
||||
#only uncomment these and supply values for setting up an Azure Cloud Demo which means azure_demo: True above
|
||||
# leave as comments unless you are deploying an public cloud Demo. Possible values are aws or azure
|
||||
public_cloud: azure
|
||||
#only uncomment these and supply values for setting up an Azure Cloud Demo which means public_cloud: azure above
|
||||
#these value below are fake sample values only
|
||||
my_subscription: bb66f723-9eb9-405b-7889-2e722a5a5a45
|
||||
my_tenant: bbe51e50-8759-5cc6-93f7-71985d8dbddf
|
||||
my_client: 7e7d5fd3-c84b-b64c-ae96-cf474f4aa573
|
||||
my_secret: K1S5~EqpmvG68i8ni9-b1hmn3~yROfHM_I
|
||||
#only uncomment these and supply values for setting up an AWS Cloud Demo which means public_cloud: aws above
|
||||
#these value below are fake sample values only
|
||||
#my_access_key: kwjewk4h54jker
|
||||
#my_secret_key: wnwrl4nwwrh6srwo4rwher4
|
||||
|
||||
|
||||
|
||||
|
||||
106
docs/infrastructure/aws_provision_vm.md
Normal file
106
docs/infrastructure/aws_provision_vm.md
Normal file
@@ -0,0 +1,106 @@
|
||||
# Demo: AMS Provision VM
|
||||
|
||||
[Click here to return to master demo list](../../README.md#demo-repository)
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Objective](#objective)
|
||||
* [What business problem is solved?](#what-business-problem-is-solved)
|
||||
* [Features show cased](#features-show-cased)
|
||||
* [Video](#video)
|
||||
* [Guide](#guide)
|
||||
|
||||
# Objective
|
||||
|
||||
Demostrate how anisble can be used to provision a RHEL VM in AWS
|
||||
|
||||
# What business problem is solved?
|
||||
|
||||
- **speed to market**:
|
||||
reducing human time to provision VMs
|
||||
- **reduce human error**:
|
||||
standardize and automation a complex set of steps to reduce human errors
|
||||
- **reduce complexity**:
|
||||
does not require a System Administrator familiar with any cloud provider or its interface in order to provision any resources
|
||||
|
||||
|
||||
# Features show cased
|
||||
|
||||
- Push button cloud provisioning
|
||||
- Self Service IT - Surveys
|
||||
|
||||
For description of these and other features of the Red Hat Ansible Automation Platform please refer to the [features README](../features.md)
|
||||
|
||||
# Video
|
||||
|
||||
Coming Soon
|
||||
|
||||
# Installing Demo
|
||||
|
||||
1. You will need to create programmatic access keys by following these [AWS Docs instructions](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html) See the section called "Programmatic access"
|
||||
|
||||
2. Then set the public_cloud variable to aws. As well as provide the folowing variable values before loading this demo as shown below.
|
||||
- public_cloud: aws
|
||||
- my_access_key:
|
||||
- my_secret_key:
|
||||
|
||||
See sample file named choose_demo_example_aws.yml
|
||||
|
||||
# Guide
|
||||
|
||||
1. Login to Ansible Platform UX
|
||||
|
||||
2. Navigate to **Templates**
|
||||
|
||||

|
||||
|
||||
3. Click the rocket next to **INFRASTRUCTURE / AWS Provision VM** to launch the Job
|
||||
|
||||

|
||||
|
||||
4. The survey will prompt you to define the key pair, AWS region, VPC, Instance Type, and name of the new VM.
|
||||
|
||||

|
||||
|
||||
5. Enter values and press **NEXT**
|
||||
|
||||

|
||||
|
||||
Explain to audience what is happening here depending on audience persona
|
||||
|
||||
**Persona A**: Technical audience that has written Ansible Playbooks before:
|
||||
Ansible can be used for more than on prem infrustructure it can also be used to provision many resource on the public clouds. Surveys create variables that the Job can use within Ansible Playbooks. This gives you the ability to create one playbook that can be used for various instance sizes of RHEL provisioned in various AWS regions instead of a job template for each region or VM provisioned. Again saving you time and effort to write seperate playbooks for each use case. In the screenshot you will see the variables are named **keypair**, **aws_region**, **vpc_name**, **instance_type** and **instance_name** with the values of testkey1, us-west-1, testvpc1, t2.micro, demo1
|
||||
|
||||
**Persona B**: Decision maker audience, IT manager or above:
|
||||
reiterate business values above. This allows a non AWS Cloud expert the ability to automate routine tasks within a cloud environment. They can't provision servers that are not vetted and put within the job template or to locations that are not preapproved within the Survey. Freeing them from the mundance and repeative task of VM provisioning while maintaining the highest level of security and compliance across your organization. In the event that your IT process does not allow the Red Hat Ansible Automation Platform to be the front end, it has a rich and powerful API that can work with existing workflows such as ServiceNow.
|
||||
|
||||
6. Execute the job by pressing the green **LAUNCH** button
|
||||
|
||||
7. Explain what is happening:
|
||||
|
||||
- Job has started executed in the background. The user can navigate off this page and the job will continue to execute.
|
||||
- On the left is the **Job Details Pane** labeled simply with **DETAILS**. This information is logged and tells you who, what, when and how.
|
||||
- **who** - who launched the job, in this example is the admin user
|
||||
- **what** - the project and Ansible Playbook used, and which credential to login to the infrastructure
|
||||
- **when** - time stamps for start, end and duration of the job run.
|
||||
- **how** - the job status (pass, fail), enviornment and execution node
|
||||
- The larger window on the right is the **Standard Out Pane**. This provides the same console output the user would be used to on the command-line for troubleshooting purposes. Some important takeways to showcase are:
|
||||
- aggregate info is at the top including the amount of Plays, tasks, hosts and time duration.
|
||||
- this pane can be expanded to take up entire browser window
|
||||
- Ansible Playbook can be downloaded for troubleshooting purposes
|
||||
- **click on task output** to show them task-by-task JSON output that can be used for troubleshooting or just getting additional information
|
||||

|
||||
|
||||
8. Circle back and summarize
|
||||
|
||||
You need to circle back what has been showcased to the [business reasons listed above](#what-business-problem-is-solved). You are welcome to verify on AWS Console that the RHEL server was actually provisioned but unless you have a very technical audience you are going to start losing folks. The real business solution here is automating away the mundane and repetative.
|
||||
|
||||
9. Verify RHEL VM is up (Optional)
|
||||
|
||||
Login to the AWS Console. Navigate to the EC2 service and locate your EC2 instances. You should see the new VM. You can cick on that new VM to see the details which should match how you defined it. Below is an example of what you will see
|
||||

|
||||
|
||||
|
||||
|
||||
---
|
||||
You have finished this demo. [Click here to return to master demo list](../../README.md#demo-repository)
|
||||
@@ -39,8 +39,8 @@ Coming Soon
|
||||
|
||||
1. You will need to create a Service Principal following these [Azure Docs instructions](https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal)
|
||||
|
||||
2. Then set the azure_demo variable to True. As well as provide the folowing variable values before loading this demo as shown below.
|
||||
- azure_demo: True
|
||||
2. Then set the public_cloud variable to azure. As well as provide the folowing variable values before loading this demo as shown below.
|
||||
- public_cloud: azure
|
||||
- my_subscription:
|
||||
- my_tenant:
|
||||
- my_client:
|
||||
|
||||
@@ -39,8 +39,8 @@ Coming Soon
|
||||
|
||||
1. You will need to create a Service Principal following these [Azure Docs instructions](https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal)
|
||||
|
||||
2. Then set the azure_demo variable to True. As well as provide the folowing variable values before loading this demo as shown below.
|
||||
- azure_demo: True
|
||||
2. Then set the public_cloud variable to azure. As well as provide the folowing variable values before loading this demo as shown below.
|
||||
- public_cloud: azure
|
||||
- my_subscription:
|
||||
- my_tenant:
|
||||
- my_client:
|
||||
|
||||
@@ -33,7 +33,7 @@ For description of these and other features of the Red Hat Ansible Automation Pl
|
||||
|
||||
# Video
|
||||
|
||||
Coming Soon
|
||||
[Chocolatey Install App Packages Video Demo](https://www.youtube.com/watch?v=6OIgqaMBnfU&list=PLdu06OJoEf2bnEaWYY0DXF90KkyqjVqOF)
|
||||
|
||||
# Guide
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ For description of these and other features of the Red Hat Ansible Automation Pl
|
||||
|
||||
# Video
|
||||
|
||||
Coming Soon
|
||||
[Windows Regedit Legal Notice Video Demo](https://www.youtube.com/watch?v=L_S74rdLat8&list=PLdu06OJoEf2bnEaWYY0DXF90KkyqjVqOF&index=2)
|
||||
|
||||
# Guide
|
||||
|
||||
|
||||
BIN
images/aws_provision_vm/aws_provision_vm_survey.jpeg
Normal file
BIN
images/aws_provision_vm/aws_provision_vm_survey.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 81 KiB |
BIN
images/aws_provision_vm/aws_provision_vm_survey_preview.jpeg
Normal file
BIN
images/aws_provision_vm/aws_provision_vm_survey_preview.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
BIN
images/aws_provision_vm/aws_provision_vm_task_output.jpeg
Normal file
BIN
images/aws_provision_vm/aws_provision_vm_task_output.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 87 KiB |
BIN
images/aws_provision_vm/aws_provision_vm_verify_ec2.jpeg
Normal file
BIN
images/aws_provision_vm/aws_provision_vm_verify_ec2.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 103 KiB |
58
playbooks/infrastructure/aws_provision_vm.yml
Normal file
58
playbooks/infrastructure/aws_provision_vm.yml
Normal file
@@ -0,0 +1,58 @@
|
||||
- name: Create AWS resources
|
||||
hosts: localhost
|
||||
connection: local
|
||||
gather_facts: False
|
||||
|
||||
collections:
|
||||
- amazon.aws
|
||||
|
||||
tasks:
|
||||
|
||||
- name: Setting the correct AMI per us-east-1
|
||||
set_fact:
|
||||
ami_id: ami-096fda3c22c1c990a
|
||||
when: aws_region == "us-east-1"
|
||||
|
||||
- name: Setting the correct AMI per us-east-1
|
||||
set_fact:
|
||||
ami_id: ami-09d9c5cdcfb8fc655
|
||||
when: aws_region == "us-west-1"
|
||||
|
||||
- name: create a new ec2 key pair
|
||||
ec2_key:
|
||||
name: "{{ keypair }}"
|
||||
region: "{{ aws_region }}"
|
||||
|
||||
- name: Create VPC
|
||||
ec2_vpc_net:
|
||||
name: "{{ vpc_name }}"
|
||||
cidr_block: 10.10.0.0/16
|
||||
region: "{{ aws_region }}"
|
||||
register: my_vpc
|
||||
|
||||
- name: Create a security group
|
||||
ec2_group:
|
||||
name: ansible
|
||||
description: "Ansible Security Group"
|
||||
region: "{{ aws_region }}"
|
||||
vpc_id: "{{ my_vpc.vpc.id }}"
|
||||
rules:
|
||||
- proto: all
|
||||
cidr_ip: 10.10.0.0/16
|
||||
- proto: all
|
||||
group_name: ansible
|
||||
rules_egress:
|
||||
- proto: all
|
||||
cidr_ip: 0.0.0.0/0
|
||||
register: firewall
|
||||
|
||||
- name: Create an EC2 instance
|
||||
ec2_instance:
|
||||
key_name: "{{ keypair }}"
|
||||
region: "{{ aws_region }}"
|
||||
security_group: "{{ firewall.group_id }}"
|
||||
instance_type: "{{ instance_type }}"
|
||||
image_id: "{{ ami_id }}"
|
||||
wait: yes
|
||||
name: "{{ instance_name }}"
|
||||
register: ec2
|
||||
14
roles/install_demo/tasks/aws.yml
Normal file
14
roles/install_demo/tasks/aws.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
- name: add aws credential
|
||||
tower_credential:
|
||||
name: aws_credential
|
||||
description: AWS Credential
|
||||
organization: "{{ vars[demo].project.organization }}"
|
||||
state: present
|
||||
kind: aws
|
||||
username: "{{ my_access_key }}"
|
||||
password: "{{ my_secret_key }}"
|
||||
tower_username: "{{ my_tower_username }}"
|
||||
tower_password: "{{ my_tower_password }}"
|
||||
tower_host: "{{ my_tower_host }}"
|
||||
validate_certs: false
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
aws_provision_vm:
|
||||
author: "David Rojas"
|
||||
readme: "https://github.com/ansible/product-demos/blob/master/docs/infrastructure/azure_provision_vm.md"
|
||||
category: infrastructure
|
||||
name: "INFRASTRUCTURE / AWS Provision VM"
|
||||
description: "Provision RHEL VM on AWS with Ansible Tower Survey and Environmental variables"
|
||||
job_type: "run"
|
||||
inventory: "Workshop Inventory"
|
||||
playbook: "playbooks/infrastructure/aws_provision_vm.yml"
|
||||
credential: "aws_credential"
|
||||
survey_enabled: true
|
||||
survey_spec:
|
||||
name: AWS Provision VM
|
||||
description: Provisioning a RHEL VM with Tower?
|
||||
spec:
|
||||
- type: text
|
||||
question_name: Enter name of the key pair to use
|
||||
question_description: This can be an existing or new key pair
|
||||
variable: keypair
|
||||
required: true
|
||||
#default:
|
||||
|
||||
- type: multiplechoice
|
||||
question_name: What AWS region do you want to host your EC2 instance
|
||||
question_description: Select one from the drop-down
|
||||
variable: aws_region
|
||||
required: true
|
||||
default: us-east-1
|
||||
choices:
|
||||
- us-east-1
|
||||
- us-west-1
|
||||
|
||||
- type: text
|
||||
question_name: Enter the name of the VPC
|
||||
question_description: This will be the VPC in which your new EC2 instance will live
|
||||
variable: vpc_name
|
||||
required: true
|
||||
|
||||
- type: multiplechoice
|
||||
question_name: What instance type would you like to select
|
||||
question_description: Select one from the drop-down
|
||||
variable: instance_type
|
||||
required: true
|
||||
default: t2.micro
|
||||
choices:
|
||||
- t2.micro
|
||||
- t2.small
|
||||
- t2.medium
|
||||
|
||||
- type: text
|
||||
question_name: Enter the name of the EC2 instance
|
||||
question_description: You can't use any special characters or whitesapces
|
||||
variable: instance_name
|
||||
required: true
|
||||
#default:
|
||||
#video: "https://www.youtube.com/watch?v=pU8ZgSBuEJw&list=PLdu06OJoEf2bp-PNtxPP_2n7Avkax8TED"
|
||||
project:
|
||||
name: "Ansible official demo project"
|
||||
description: "prescriptive demos from Red Hat Management Business Unit"
|
||||
organization: "Default"
|
||||
scm_type: git
|
||||
scm_url: "https://github.com/davidrojas25/product-demos"
|
||||
workshop_type:
|
||||
- windows
|
||||
- demo
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
azure_mysql_server:
|
||||
author: "David Rojas"
|
||||
readme: "https://github.com/ansible/product-demos/blob/master/docs/infrastructure/azure_provision_vm.md"
|
||||
readme: "https://github.com/ansible/product-demos/blob/master/docs/infrastructure/azure_mysql_server.md"
|
||||
category: infrastructure
|
||||
name: "INFRASTRUCTURE / Azure create a MySQL Server"
|
||||
description: "Provision MySQL server on Azure with Ansible Tower Survey and Environmental variables"
|
||||
|
||||
Reference in New Issue
Block a user