Ansible_Tower_Workshop
is a ansible playbook to provision Ansible Tower in AWS. This playbook uses Ansible to wrap Terraform, for provisioning AWS infrastructure and nodes. To find more info about Terraform check here
These modules all require that you have AWS API keys available to use to provision AWS resources. You also need to have IAM permissions set to allow you to create resources within AWS. There are several methods for setting up you AWS environment on you local machine.
Export the AWS API Keys by hand;
export AWS_ACCESS_KEY_ID='****************WFQ'
export AWS_SECRET_ACCESS_KEY='****************TFHJw'
This repo also requires that you have Ansible installed on your local machine. For the most upto date methods of installing Ansible for your operating system check here.
This repo also requires that Terraform be installed if you are using the aws.infra.terraform role. For the most upto data methods of installing Terraform for your operating system check here.
If you are only doing an Ansible workshop, subscribing the nodes is not necessary, so you may edit the following file: roles/ansible.tower/tasks/main.yml Comment out the line that includes the RH subscriptions.
To create infrastructure and a Ansible Tower instance via Terraform
brew install terraform
Then edit group_vars/all
and fill in the vars with your AWS api info. This role can also provide easy domain name mapping to all the instances if you have a domain registered in AWS Route 53.
#####################################################
# Domain Name you own
#####################################################
domain_name: ""
zone_id: ""
#####################################################
# AWS API Keys for terraform.tfvars file
#####################################################
aws_access_key: ""
aws_secret_key: ""
ansible-playbook -i inventory 1_aws_infra.yml
To destroy
cd /tmp/terraform
terraform destroy
The ansible.tower role configures the instance with the tower-cli
. By default the ansible.tower
role installs 15 student accounts and associates them with a default Lab Team
& Lab Organization
.
To target the newly created EC2 instance use the ec2.py
module located in the /inventory/
folder. The ec2.py is a dynamic script that queries Amazon for your instances.
ansible-playbook -i inventory 2_aws_ec2.yml
browse to the public ip of the EC2 instance and enter the admin
password located in roles/ansible.tower/vars/main.yml
.