A hands-on workshop to become familiar with Hashicorp Terraform to provision and configure infrastructure and Red Hat Ansible to configure systems and deploy applications.
- Lesson-01 - Terraform basics
- Lesson-02 - Terraform variables, output, and data
- Lesson-03 - More Terraform variables, plans, workspaces, and security
- Lesson-04 - Building an Ansible sandbox
- Lesson-05 - Ansible basics
- Lesson-06 - Playbook basics
- Lesson-07 - Practical Ansible
- Lesson-08 - Full web application
- Demo-09 - Putting it all together
To get the most out of this workshop, you will need the following:
- Terraform installed
- SSH client
- AWS account with adequate permissions
- AWS CLI installed and configured
- AWS EC2 key pair
Install Terraform on your laptop and make sure it is on your path.
$ terraform --version
Terraform v1.5.0
on linux_amd64
You should have an SSH client installed and be familiar with using it. PuTTY is an option for Windows, but most Windows users will be better served with the client that comes with Git Bash. Other OSes likely have the client already installed.
$ ssh -V
OpenSSH_8.2p1 Ubuntu-4ubuntu0.7, OpenSSL 1.1.1f 31 Mar 2020
You'll need an AWS account. The AWS Free Tier is sufficient.
If you are not the root account holder, make sure you have sufficient permissions
to create EC2 instances. The AWS Managed AmazonEC2FullAccess
policy should be
enough.
You will need an AWS Access Key ID
and AWS Secret Access Key
available to you.
Creating an access key
specifically for this workshop might be a good idea.
You must install the AWS CLI
and configure it to use the AWS Access Key ID
and AWS Secret Access Key
you
created previously.
Use aws configure
to set up
the AWS CLI to use them.
Ensure the configuration is in place and you can access AWS via the CLI.
$ aws configure
AWS Access Key ID [****************5W7F]:
AWS Secret Access Key [****************G9m9]:
Default region name [us-east-2]:
Default output format [json]:
$ aws sts get-caller-identity
{
"UserId": "AIDA6J6IBOTSMECN2JXTM",
"Account": "983430165732",
"Arn": "arn:aws:iam::983430165732:user/gene.gotimer-terraform"
}
Create an EC2 key pair and configure your SSH client to use it. Some clients (cough PuTTY cough) need the key converted for use, so pay attention to your SSH client documentation.
$ aws ec2 describe-key-pairs
{
"KeyPairs": [
{
"KeyPairId": "key-0343183b6656b1f95",
"KeyFingerprint": "c9:26:37:46:e7:43:a4:c5:e4:61:a0:d8:ac:7b:54:f0:3b:9f:8d:99",
"KeyName": "gene-test-us-east-2",
"KeyType": "rsa",
"Tags": [],
"CreateTime": "2023-03-08T20:34:04.339000+00:00"
}
]
}
We will be copying the public and private keys on to AWS EC2 instances, so you might want to create a key pair just for this workshop and then delete it immediately after, just in case.