terraform-aap - Demo for installing and configuring AAP using Terraform and IaC

Quick start

Before you begin, you will need the following information:

  • An offline token for downloading the AAP installation bundle. One can be generated on the Red Hat Customer Portal.
  • An Automation Hub token for downloading content from the Red Hat Automation Hub. One can be generated on the Automation Hub
  • An AWS access key and secret key, used by terraform to create the AAP infrastructure on AWS.

Set up prerequisites

  1. Clone the repo and cd into the repo directory

  2. Create an Ansible vault file

    • cp vars/vault.yml.example vars/vault.yml
    • ansible-vault encrypt vars/vault.yml
    • ansible-vault edit vars/vault.yml, and modify the vault variable defaults per the comments in the file
  3. Create the vars/terraform_aap.yml file

    • cp vars/terraform_aap.yml.example vars/terraform_aap.yml
    • Change the 'terraform_build_name' variable. This build name will be used when cloning the terraform infra repo.
    • Change the 'terraform_aws_region' variable if a different AWS region is desired.
    • Change the 'terraform_state_aws_bucket' variable to a unique S3 bucket name. This bucket will be created in the AWS region specified.
  4. Create the vars/aap_setup.yml file

    • cp vars/aap_setup.yml.example vars/aap_setup.yml
  5. Set the AWS-related shell environment variables

    • export AWS_ACCESS_KEY_ID="my-aws-access-key"
    • export AWS_SECRET_ACCESS_KEY="my-aws-secret-key"
  6. Set the Automation Hub shell environment variable

  7. ansible-galaxy collection install -r collections/requirements.yml

  8. ansible-galaxy role install -r roles/requirements.yml

  9. Install the python boto3 requirement for amazon.aws pip3 install --user boto3

  10. Install terraform

Create AAP infrastructure

  1. ansible-playbook terraform-aap-on-aws.yml

  2. Optionally, ansible-playbook stig-controllers.yml to apply the RHEL STIG to the controller node(s)

  3. ansible-playbook install-aap.yml --ask-vault-pass

The Details

Work in progress