Skip to content

Commit 8f2a83d

Browse files
committed
feat: add ability to create multiple aws machines
Signed-off-by: ehila <ehila@redhat.com>
1 parent 1ee4474 commit 8f2a83d

File tree

9 files changed

+74
-8
lines changed

9 files changed

+74
-8
lines changed

deploy/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,60 @@ $ make force-stop
106106
$ make destroy
107107
```
108108

109+
### Managing Multiple AWS Metal Machines
110+
111+
The tooling supports deploying and managing multiple AWS metal machines simultaneously. This is useful for testing different configurations or running multiple clusters in parallel.
112+
113+
#### How It Works
114+
115+
Two key variables in `aws-hypervisor/instance.env` control which machine you're working with:
116+
- **`SHARED_DIR`**: The directory where instance data is stored (e.g., `instance-data-machine1`)
117+
- **`STACK_NAME`**: The CloudFormation stack name (e.g., `machine1`)
118+
119+
Each unique combination of these variables represents a separate AWS metal machine deployment.
120+
121+
#### Workflow for Multiple Machines
122+
123+
**Initial deployment of a machine:**
124+
```bash
125+
# Edit instance.env to set your first deployment
126+
export SHARED_DIR=instance-data-machine1
127+
export STACK_NAME=machine1
128+
129+
# Deploy the machine
130+
$ make deploy
131+
```
132+
133+
**Deploy a second machine:**
134+
```bash
135+
# Edit instance.env with new values
136+
export SHARED_DIR=instance-data-machine2
137+
export STACK_NAME=machine2
138+
139+
# Deploy the second machine
140+
$ make deploy
141+
```
142+
143+
**Switch between machines:**
144+
145+
To switch which machine you're working with, simply update the two variables in `instance.env` and update the inventory:
146+
147+
```bash
148+
# Edit instance.env to point to the machine you want
149+
export SHARED_DIR=instance-data-machine1
150+
export STACK_NAME=machine1
151+
152+
# Update SSH configuration to point to this machine
153+
$ make inventory
154+
155+
# Now use any command normally (it will operate on machine1)
156+
$ make fencing-ipi
157+
$ make ssh
158+
$ make stop
159+
```
160+
161+
This allows you to seamlessly switch between different AWS metal machines without any additional configuration changes.
162+
109163
### OpenShift Cluster Management
110164

111165
When running OpenShift clusters on the instance (using dev-scripts), you have several options for managing cluster lifecycle:

deploy/aws-hypervisor/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
instance.env
2-
instance-data
2+
instance-data*/
33
pull_secret.json

deploy/openshift-clusters/roles/dev-scripts/install-dev/vars/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ make_target:
1414
ipi: "all"
1515
agent: "agent"
1616
# Cluster state management variables
17-
cluster_state_dir: "../aws-hypervisor/instance-data"
17+
cluster_state_dir: "../aws-hypervisor/{{ lookup('env', 'SHARED_DIR') }}"
1818
cluster_state_filename: "cluster-vm-state.json"

deploy/openshift-clusters/scripts/clean.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ set -o nounset
99
set -o errexit
1010
set -o pipefail
1111

12+
source "${DEPLOY_DIR}/aws-hypervisor/instance.env"
13+
1214
# Check if instance data exists
13-
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/instance-data/aws-instance-id" ]]; then
15+
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/${SHARED_DIR}/aws-instance-id" ]]; then
1416
echo "Error: No instance found. Please run 'make deploy' first."
1517
exit 1
1618
fi

deploy/openshift-clusters/scripts/deploy-arbiter-agent.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ set -o nounset
99
set -o errexit
1010
set -o pipefail
1111

12+
source "${DEPLOY_DIR}/aws-hypervisor/instance.env"
13+
1214
# Check if instance data exists
13-
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/instance-data/aws-instance-id" ]]; then
15+
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/${SHARED_DIR}/aws-instance-id" ]]; then
1416
echo "Error: No instance found. Please run 'make deploy' first."
1517
exit 1
1618
fi

deploy/openshift-clusters/scripts/deploy-arbiter-ipi.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ set -o nounset
99
set -o errexit
1010
set -o pipefail
1111

12+
source "${DEPLOY_DIR}/aws-hypervisor/instance.env"
13+
1214
# Check if instance data exists
13-
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/instance-data/aws-instance-id" ]]; then
15+
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/${SHARED_DIR}/aws-instance-id" ]]; then
1416
echo "Error: No instance found. Please run 'make deploy' first."
1517
exit 1
1618
fi

deploy/openshift-clusters/scripts/deploy-fencing-agent.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ set -o nounset
99
set -o errexit
1010
set -o pipefail
1111

12+
source "${DEPLOY_DIR}/aws-hypervisor/instance.env"
13+
1214
# Check if instance data exists
13-
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/instance-data/aws-instance-id" ]]; then
15+
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/${SHARED_DIR}/aws-instance-id" ]]; then
1416
echo "Error: No instance found. Please run 'make deploy' first."
1517
exit 1
1618
fi

deploy/openshift-clusters/scripts/deploy-fencing-ipi.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ set -o nounset
99
set -o errexit
1010
set -o pipefail
1111

12+
source "${DEPLOY_DIR}/aws-hypervisor/instance.env"
13+
1214
# Check if instance data exists
13-
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/instance-data/aws-instance-id" ]]; then
15+
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/${SHARED_DIR}/aws-instance-id" ]]; then
1416
echo "Error: No instance found. Please run 'make deploy' first."
1517
exit 1
1618
fi

deploy/openshift-clusters/scripts/full-clean.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ set -o nounset
99
set -o errexit
1010
set -o pipefail
1111

12+
source "${DEPLOY_DIR}/aws-hypervisor/instance.env"
13+
1214
# Check if instance data exists
13-
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/instance-data/aws-instance-id" ]]; then
15+
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/${SHARED_DIR}/aws-instance-id" ]]; then
1416
echo "Error: No instance found. Please run 'make deploy' first."
1517
exit 1
1618
fi

0 commit comments

Comments
 (0)