This directory contains scripts for managing EC2 instances used as hypervisors for OpenShift development.
Copy the instance.env.template file to instance.env and set all variables to valid values for your user.
cp instance.env.template instance.env
# Edit instance.env with your specific valuesFor a completely automated deployment without manual intervention, you can configure Red Hat Subscription Manager (RHSM) activation key variables in your instance.env file:
# Uncomment and set these variables for automated RHSM registration
export RHSM_ACTIVATION_KEY="your-activation-key-here"
export RHSM_ORG="your-org-id-here"To obtain your activation key and organization ID, refer to Red Hat documentation: https://access.redhat.com/solutions/3341191
When these variables are properly configured, the system will automatically register with RHSM during initialization, eliminating the need for manual registration steps.
To verify your environment is setup properly, source the instance.env and ensure it doesn't throw errors:
source ./instance.envCreates a new EC2 instance using CloudFormation. Reads configuration from instance.env.
./scripts/create.shInitializes a deployed instance by uploading necessary files and running initial setup.
./scripts/init.shStarts a stopped EC2 instance and performs necessary post-startup checks.
./scripts/start.shStops a running EC2 instance with interactive cluster management options. The script will:
- Detect if OpenShift clusters are running
- Offer options for graceful cluster shutdown or cleanup
- Safely stop the instance based on user selection
./scripts/stop.shCompletely destroys the EC2 instance and all associated CloudFormation resources.
./scripts/destroy.shEstablishes SSH connection to the EC2 instance using the configured key and user.
./scripts/ssh.shDisplays current instance information including IP addresses, instance ID, and connection details.
./scripts/print_instance_data.shUpdates the ../openshift-clusters/inventory.ini file with the current instance IP address.
./scripts/inventory.shThis script is deployed to the EC2 instance during initialization and should be run after first login to complete the setup.
Location on instance: ~/configure.sh
Interactive Configuration: If RHSM variables are not configured, you will be asked to:
- Set a password for pitadmin (cockpit access)
- Register the system using your RHSM login for dnf access to various repositories
Automated Configuration:
If you have configured the RHSM activation key variables in your instance.env file, the system registration will be handled automatically, requiring only the pitadmin password configuration.
# Run on the EC2 instance after first login
[ec2-user@ip-x-x-x-x ~]$ ./configure.shAll scripts expect:
- Properly configured
instance.envfile - AWS CLI configured with appropriate credentials
- SSH key file accessible at the path specified in
instance.env
Instance metadata is stored in the instance-data/ directory:
aws-instance-id: EC2 instance IDprivate_address: Instance private IPpublic_address: Instance public IPssh_user: SSH username for the instance- Additional CloudFormation and configuration data