Checking in to change environments.
This commit is contained in:
+4
-2
@@ -84,13 +84,15 @@ for GROUP in $ANS_GROUPS; do
|
|||||||
# HOSTNAME1=0.0.0.0
|
# HOSTNAME1=0.0.0.0
|
||||||
# HOSTNAME2=0.0.0.0
|
# HOSTNAME2=0.0.0.0
|
||||||
VARS="$(
|
VARS="$(
|
||||||
echo $DATA | \
|
echo -n $DATA | \
|
||||||
jq '.[] | select(.group=="'"$GROUP"'") | .vms[] |
|
jq '.[] | select(.group=="'"$GROUP"'") | .vms[] |
|
||||||
"\(.hostname)=\(.ip)"' | \
|
"\(.hostname)=\(.ip)"' | \
|
||||||
sed 's/"//g' | \
|
sed 's/"//g' | \
|
||||||
sed "s/$VM_NAME_PREFIX-//g" | \
|
sed "s/$VM_NAME_PREFIX-//g" | \
|
||||||
sed 's/-/_/g'
|
sed 's/-/_/g'
|
||||||
)"
|
)"
|
||||||
# Print the contents of $VARS converted to uppercase.
|
# Print the contents of $VARS converted to uppercase. If it's not expty.
|
||||||
|
if [ ! -z $VARS ]; then
|
||||||
echo "${VARS^^}"
|
echo "${VARS^^}"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -4,18 +4,21 @@ locals {
|
|||||||
module.aws-network-existing.subnet-by-name["subnet_1"].id,
|
module.aws-network-existing.subnet-by-name["subnet_1"].id,
|
||||||
module.aws-network-existing.subnet-by-name["subnet_3"].id,
|
module.aws-network-existing.subnet-by-name["subnet_3"].id,
|
||||||
]
|
]
|
||||||
|
nfs-subnets = [
|
||||||
|
module.aws-network-existing.subnet-by-name["subnet_4"],
|
||||||
|
]
|
||||||
nodes-config = {
|
nodes-config = {
|
||||||
"k8s-master" = {
|
"k8s-master" = {
|
||||||
base-image = var.ubuntu-ami
|
base-image = var.ubuntu-ami
|
||||||
aws-ec2-type = var.t2-medium-4gib-2vcpu
|
aws-ec2-type = var.t2-medium-4gib-2vcpu
|
||||||
subnet-ids = local.k8s-subnets-ids
|
subnet-ids = local.k8s-subnets-ids
|
||||||
num = 1
|
num = 0
|
||||||
},
|
},
|
||||||
"k8s-worker" = {
|
"k8s-worker" = {
|
||||||
base-image = var.ubuntu-ami
|
base-image = var.ubuntu-ami
|
||||||
aws-ec2-type = var.t2-medium-4gib-2vcpu
|
aws-ec2-type = var.t2-medium-4gib-2vcpu
|
||||||
subnet-ids = local.k8s-subnets-ids
|
subnet-ids = local.k8s-subnets-ids
|
||||||
num = 2
|
num = 0
|
||||||
},
|
},
|
||||||
"ansible-test" = {
|
"ansible-test" = {
|
||||||
base-image = var.ubuntu-ami
|
base-image = var.ubuntu-ami
|
||||||
@@ -97,8 +100,21 @@ resource "aws_key_pair" "key" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# resource "aws_ebs_volume" "zfs" {
|
resource "aws_ebs_volume" "zfs" {
|
||||||
# availability_zone =
|
# TODO REM look at types.
|
||||||
|
availability_zone = local.nfs-subnets[0].availability_zone
|
||||||
|
size = 10
|
||||||
|
encrypted = false
|
||||||
|
tags = {
|
||||||
|
Name = "zfs-disk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_volume_attachment" "mount-nfs-volume" {
|
||||||
|
device_name = "/dev/sdf"
|
||||||
|
instance_id = module.nodes["nfs"].nodes[0].id
|
||||||
|
volume_id = aws_ebs_volume.zfs.id
|
||||||
|
}
|
||||||
|
|
||||||
module "nodes" {
|
module "nodes" {
|
||||||
for_each = local.nodes-config
|
for_each = local.nodes-config
|
||||||
|
|||||||
@@ -9,3 +9,7 @@ output "private_ips" {
|
|||||||
output "names" {
|
output "names" {
|
||||||
value = aws_instance.nodes.*.tags.Name
|
value = aws_instance.nodes.*.tags.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output "nodes" {
|
||||||
|
value = aws_instance.nodes
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user