Fix machine resources for placement and update/add new machine ids

This commit is contained in:
Arif Ali 2024-05-12 21:58:33 +01:00
parent 1ad98dcf6e
commit 84080f9d8d
Signed by: arif
GPG Key ID: 369608FBA1353A70
17 changed files with 64 additions and 74 deletions

View File

@ -11,16 +11,26 @@ variable "num_units" {
variable "controller_ids" {
type = list(string)
default = ["100", "101", "102",
default = ["100", "101", "102",
"103", "104", "105"]
}
variable "controller_ids_high" {
type = list(string)
default = ["103", "104", "105"]
}
variable "compute_ids" {
type = list(string)
default = ["1000", "1001", "1002", "1003",
default = ["1000", "1001", "1002", "1003",
"1004", "1005", "1006", "1007"]
}
variable "sdn_ids" {
type = list(string)
default = ["400", "401", "402"]
}
variable "apt_mirror" {
type = string
default = "192.168.1.12"
@ -69,17 +79,17 @@ variable mysql-router-channel {
default = "8.0/stable"
}
variable "hacluster-channel" {
variable hacluster-channel {
type = string
default = "2.0.3/stable"
}
variable "rabbitmq-server-channel" {
variable rabbitmq-server-channel {
type = string
default = "3.8/stable"
}
variable "ceph-channel" {
variable ceph-channel {
type = string
default = "octopus/stable"
}

View File

@ -1,7 +1,7 @@
resource "juju_machine" "keystone" {
count = var.num_units
model = var.model-name
placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index+var.num_units]].machine_id])
placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids_high[count.index+var.num_units]].machine_id])
constraints = "spaces=oam"
}
@ -18,8 +18,8 @@ resource "juju_application" "keystone" {
units = var.num_units
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, var.num_units, length(var.controller_ids)) :
juju_machine.keystone[index].machine_id
for res in juju_machine.keystone :
res.machine_id
]))}"
endpoint_bindings = [{

View File

@ -19,8 +19,8 @@ resource "juju_application" "mysql-innodb-cluster" {
units = var.num_units
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, 0, var.num_units+1) :
juju_machine.mysql[index].machine_id
for res in juju_machine.mysql :
res.machine_id
]))}"
endpoint_bindings = [{

View File

@ -18,8 +18,8 @@ resource "juju_application" "rabbitmq-server" {
units = 3
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, var.num_units, length(var.controller_ids)) :
juju_machine.rmq[index].machine_id
for res in juju_machine.rmq :
res.machine_id
]))}"
endpoint_bindings = [{

View File

@ -18,8 +18,8 @@ resource "juju_application" "ceilometer" {
units = 3
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, var.num_units, length(var.controller_ids)) :
juju_machine.ceilometer[index].machine_id
for res in juju_machine.ceilometer :
res.machine_id
]))}"
endpoint_bindings = [{

View File

@ -5,13 +5,13 @@ resource "juju_application" "ceph-osd" {
charm {
name = "ceph-osd"
channel = var.ceph-osd-channel
channel = var.ceph-channel
}
units = length(var.compute_ids)
placement = "${join(",", sort([
for index, _ in var.compute_ids :
for index, _ in var.compute_ids :
juju_machine.all_machines[index].machine_id
]))}"
@ -47,8 +47,8 @@ resource "juju_application" "ceph-mon" {
units = var.num_units
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, 0, var.num_units+1) :
juju_machine.ceph-mon[index].machine_id
for res in juju_machine.ceph-mon :
res.machine_id
]))}"
endpoint_bindings = [{
@ -98,8 +98,8 @@ resource "juju_application" "ceph-radosgw" {
units = var.num_units
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, 0, var.num_units+1) :
juju_machine.ceph-rgw[index].machine_id
for res in juju_machine.ceph-rgw :
res.machine_id
]))}"
endpoint_bindings = [{

View File

@ -18,8 +18,8 @@ resource "juju_application" "cinder" {
units = var.num_units
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, 0, var.num_units+1) :
juju_machine.cinder[index].machine_id
for res in juju_machine.cinder :
res.machine_id
]))}"
endpoint_bindings = [{

View File

@ -18,8 +18,8 @@ resource "juju_application" "glance" {
units = var.num_units
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, 0, var.num_units+1) :
juju_machine.glance[index].machine_id
for res in juju_machine.glance :
res.machine_id
]))}"
endpoint_bindings = [{

View File

@ -1,7 +1,7 @@
resource "juju_machine" "gnocchi" {
count = var.num_units
model = var.model-name
placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index+var.num_units]].machine_id])
placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids_high[count.index+var.num_units]].machine_id])
constraints = "spaces=oam,ceph-access"
}
@ -18,8 +18,8 @@ resource "juju_application" "gnocchi" {
units = var.num_units
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, var.num_units, length(var.controller_ids)) :
juju_machine.gnocchi[index].machine_id
for res in juju_machine.gnocchi :
res.machine_id
]))}"
endpoint_bindings = [{

View File

@ -18,8 +18,8 @@ resource "juju_application" "heat" {
units = var.num_units
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, 0, var.num_units+1) :
juju_machine.heat[index].machine_id
for res in juju_machine.heat :
res.machine_id
]))}"
endpoint_bindings = [{

View File

@ -19,8 +19,8 @@ resource "juju_application" "memcached" {
units = var.num_units
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, 0, var.num_units+1) :
juju_machine.memcached[index].machine_id
for res in juju_machine.memcache :
res.machine_id
]))}"

View File

@ -1,7 +1,7 @@
resource "juju_machine" "ncc" {
count = var.num_units
model = var.model-name
placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index+var.num_units]].machine_id])
placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids_high[count.index+var.num_units]].machine_id])
constraints = "spaces=oam"
}
@ -18,8 +18,8 @@ resource "juju_application" "nova-cloud-controller" {
units = var.num_units
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, var.num_units, length(var.controller_ids)) :
juju_machine.ncc[index].machine_id
for res in juju_machine.ncc :
res.machine_id
]))}"
endpoint_bindings = [{

View File

@ -1,7 +1,7 @@
resource "juju_machine" "placement" {
count = var.num_units
model = var.model-name
placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index+var.num_units]].machine_id])
placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids_high[count.index+var.num_units]].machine_id])
constraints = "spaces=oam"
}
@ -18,8 +18,8 @@ resource "juju_application" "placement" {
units = var.num_units
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, var.num_units, length(var.controller_ids)) :
juju_machine.placement[index].machine_id
for res in juju_machine.placement :
res.machine_id
]))}"
endpoint_bindings = [{

View File

@ -11,7 +11,7 @@ resource "juju_application" "nova-compute-kvm" {
units = length(var.compute_ids)
placement = "${join(",", sort([
for index, _ in var.compute_ids :
for index, _ in var.compute_ids :
juju_machine.all_machines[index].machine_id
]))}"

View File

@ -13,7 +13,7 @@ resource "juju_application" "controller-server" {
units = length(var.controller_ids)
placement = "${join(",", sort([
for index, _ in var.controller_ids :
for index, _ in var.controller_ids :
juju_machine.all_machines[index].machine_id
]))}"
}

View File

@ -11,8 +11,8 @@ resource "juju_application" "neutron-gateway" {
units = var.num_units
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, 0, var.num_units+1) :
juju_machine.neutron-api[index].machine_id
for index, _ in slice(var.controller_ids, 0, var.num_units+1) :
juju_machine.all_machines[index].machine_id
]))}"
@ -47,8 +47,8 @@ resource "juju_application" "neutron-api" {
units = var.num_units
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, 0, var.num_units+1) :
juju_machine.neutron-api[index].machine_id
for res in juju_machine.neutron-api :
res.machine_id
]))}"
endpoint_bindings = [{

View File

@ -1,16 +1,7 @@
resource "juju_machine" "vault-1" {
resource "juju_machine" "vault" {
count = var.num_units
model = var.model-name
placement = join(":",["lxd",juju_machine.all_machines["400"].machine_id])
constraints = "spaces=oam"
}
resource "juju_machine" "vault-2" {
model = var.model-name
placement = join(":",["lxd",juju_machine.all_machines["401"].machine_id])
constraints = "spaces=oam"
}
resource "juju_machine" "vault-3" {
model = var.model-name
placement = join(":",["lxd",juju_machine.all_machines["402"].machine_id])
placement = join(":",["lxd",juju_machine.all_machines[var.sdn_ids[count.index+var.num_units]].machine_id])
constraints = "spaces=oam"
}
@ -25,12 +16,11 @@ resource "juju_application" "vault" {
base = var.default-base
}
units = 3
units = var.num_units
placement = "${join(",",sort([
juju_machine.vault-1.machine_id,
juju_machine.vault-2.machine_id,
juju_machine.vault-3.machine_id,
for res in juju_machine.vault :
res.machine_id
]))}"
config = {
@ -83,19 +73,10 @@ resource "juju_application" "hacluster-vault" {
}
resource "juju_machine" "etcd-1" {
resource "juju_machine" "etcd" {
count = var.num_units
model = var.model-name
placement = join(":",["lxd",juju_machine.all_machines["400"].machine_id])
constraints = "spaces=oam"
}
resource "juju_machine" "etcd-2" {
model = var.model-name
placement = join(":",["lxd",juju_machine.all_machines["401"].machine_id])
constraints = "spaces=oam"
}
resource "juju_machine" "etcd-3" {
model = var.model-name
placement = join(":",["lxd",juju_machine.all_machines["402"].machine_id])
placement = join(":",["lxd",juju_machine.all_machines[var.sdn_ids[count.index+var.num_units]].machine_id])
constraints = "spaces=oam"
}
@ -112,9 +93,8 @@ resource "juju_application" "etcd" {
}
placement = "${join(",",sort([
juju_machine.etcd-1.machine_id,
juju_machine.etcd-2.machine_id,
juju_machine.etcd-3.machine_id,
for res in juju_machine.etcd :
res.machine_id
]))}"
endpoint_bindings = [{