Skip to content

Commit

Permalink
updated variables and the help verbage and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
aganesh-suse committed Jul 13, 2023
1 parent c4dac11 commit e036e2e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
5 changes: 3 additions & 2 deletions qa/aws-ec2-mgr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@ Usage:
*** Did not find rhel8.8_arm ami
SLES: sles15sp4_arm, sles15sp4
Ubuntu: ubuntu22.4, ubuntu22.4_arm, ubuntu20.4, ubuntu20.4_arm
Oracle Linux: OL8.6, OL8.7, OL8.8(ProComputer), OL9, OL9.1, OL9.2
Oracle Linux: OL8.6, OL8.7, OL8.8 (ProComputer), OL9, OL9.1, OL9.2
** All are packer generated AMIs
Most images are packer edited from Tiov IT - use 'cloud-user' for ssh
AMI packer generated from ProComputer - use 'ec2-user' for ssh. Double check the firewall service.
*** Did not find arm ami's for Oracle Linux
Rocky: rocky8.6, rocky8.6_arm, rocky8.7(packer edited), rocky8.7_arm, rock8.8, rocky8.8_arm, rocky9, rocky9.1, rocky9.1_arm, rocky9.2, rocky9.2_arm
Rocky: rocky8.6, rocky8.6_arm, rocky8.7 (packer edited), rocky8.7_arm, rock8.8, rocky8.8_arm, rocky9, rocky9.1, rocky9.1_arm, rocky9.2, rocky9.2_arm
-p prefix: used to append to name tag the ec2 instance - you can also export PREFIX var to set as default value, if not using this option
-k key_name: key-pair login name used from aws registry to login securely to your ec2 instances - export KEY_NAME var to set as default value, if not using this option
-f pem_file_path: absolute file path of your .pem file - for ssh command to your ec2 instances - export PEM_FILE_PATH var to set as default value, if not using this option
-c count: How many ec2 instances do you want to launch?
-v volume_size: Recommend 20 (20GB for EBS volume) for k3s setup. Recommend 30 (30GB for EBS volume)for rke2 setups. Default value is 30.
-s server_count: Can be 3 for 3 servers 1 agent or 2 for 2 servers and 2 agents; To be used with the -g get_running option or -d deploy option
-h help - usage is displayed
```

Expand Down
29 changes: 15 additions & 14 deletions qa/aws-ec2-mgr/aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ do
f) PEM_FILE_PATH_VAR=${OPTARG};;
c) COUNT=${OPTARG};;
v) VOLUME_SIZE=${OPTARG};;
s) NUM_OF_SERVERS=${OPTARG};;
s) SERVER_COUNT=${OPTARG};;
h|?)
echo "
Usage:
Expand All @@ -34,18 +34,18 @@ do
*** Did not find rhel8.8_arm ami
SLES: sles15sp4_arm, sles15sp4
Ubuntu: ubuntu22.4, ubuntu22.4_arm, ubuntu20.4, ubuntu20.4_arm
Oracle Linux: OL8.6, OL8.7, OL8.8(ProComputer), OL9, OL9.1, OL9.2
Oracle Linux: OL8.6, OL8.7, OL8.8 (ProComputer), OL9, OL9.1, OL9.2
** All are packer generated AMIs
Most images are packer edited from Tiov IT - use 'cloud-user' for ssh
AMI packer generated from ProComputer - use 'ec2-user' for ssh. Double check the firewall service.
*** Did not find arm ami's for Oracle Linux
Rocky: rocky8.6, rocky8.6_arm, rocky8.7(packer edited), rocky8.7_arm, rock8.8, rocky8.8_arm, rocky9, rocky9.1, rocky9.1_arm, rocky9.2, rocky9.2_arm
Rocky: rocky8.6, rocky8.6_arm, rocky8.7 (packer edited), rocky8.7_arm, rock8.8, rocky8.8_arm, rocky9, rocky9.1, rocky9.1_arm, rocky9.2, rocky9.2_arm
-p prefix: used to append to name tag the ec2 instance - you can also export PREFIX var to set as default value, if not using this option
-k key_name: key-pair login name used from aws registry to login securely to your ec2 instances - export KEY_NAME var to set as default value, if not using this option
-f pem_file_path: absolute file path of your .pem file - for ssh command to your ec2 instances - export PEM_FILE_PATH var to set as default value, if not using this option
-c count: How many ec2 instances do you want to launch?
-v volume_size: Recommend 20 (20GB for EBS volume) for k3s setup. Recommend 30 (30GB for EBS volume)for rke2 setups. Default value is 30.
-r ratio: Can be 3:1 for 3 servers 1 agent or 2:2 for 2 servers and 2 agents; To be used with the -g get_running option
-s server_count: Can be 3 for 3 servers 1 agent or 2 for 2 servers and 2 agents; To be used with the -g get_running option or -d deploy option
-h help - usage is displayed
"
exit 1
Expand Down Expand Up @@ -209,7 +209,8 @@ case ${OS_NAME} in
if [ "${LOG}" = "debug" ]; then
echo "WARN: Setting OS_NAME = ${OS_NAME}"
fi
IMAGE_ID="ami-024e6efaf93d85776"
# IMAGE_ID="ami-024e6efaf93d85776"
IMAGE_ID="ami-097a2df4ac947655f"
# IMAGE_ID="ami-0a695f0d95cefc163" # previous image id used
SSH_USER="ubuntu"
INSTANCE_TYPE="t3.medium"
Expand Down Expand Up @@ -334,12 +335,12 @@ if [ "${ACTION}" = "deploy" ] || [ "${ACTION}" = "get_running" ]; then
fi
fi

if [ -z "${NUM_OF_SERVERS}" ]; then
NUM_OF_SERVERS=3
if [ -z "${SERVER_COUNT}" ]; then
SERVER_COUNT=3
fi

if [ "${NUM_OF_SERVERS}" ]; then
NUM_OF_AGENTS=$((COUNT-NUM_OF_SERVERS))
if [ "${SERVER_COUNT}" ]; then
AGENT_COUNT=$((COUNT-SERVER_COUNT))
fi


Expand All @@ -358,12 +359,12 @@ get_ssh_info () {
get_setup_vars () {
while read -r LINE
do
if [ "$NUM_OF_SERVERS" = 0 ]; then
echo "AGENT${NUM_OF_AGENTS}=\"${LINE}\""
NUM_OF_AGENTS=$((NUM_OF_AGENTS-1))
if [ "${SERVER_COUNT}" = 0 ]; then
echo "AGENT${AGENT_COUNT}=\"${LINE}\""
AGENT_COUNT=$((AGENT_COUNT-1))
else
echo "SERVER$NUM_OF_SERVERS=\"${LINE}\""
NUM_OF_SERVERS=$((NUM_OF_SERVERS-1))
echo "SERVER${SERVER_COUNT}=\"${LINE}\""
SERVER_COUNT=$((SERVER_COUNT-1))
fi
done < "${PUBLIC_IPS_FILE_PATH}"
}
Expand Down

0 comments on commit e036e2e

Please sign in to comment.