terraform/juju/home-maas/05-ceph.tf

204 lines
4.3 KiB
Terraform
Raw Normal View History

resource "juju_application" "ceph-osd" {
name = "ceph-osd"
model = var.model-name
charm {
2024-05-07 19:23:43 +00:00
name = "ceph-osd"
2024-05-12 13:43:53 +00:00
channel = var.ceph-osd-channel
}
2024-05-12 13:43:53 +00:00
units = length(var.compute_ids)
placement = "${join(",", sort([
for index, _ in var.compute_ids :
juju_machine.all_machines[index].machine_id
]))}"
config = {
2024-05-07 19:23:43 +00:00
osd-devices = var.osd-devices
source = var.openstack-origin
aa-profile-mode = "complain"
customize-failure-domain = "true"
2024-05-07 19:23:43 +00:00
autotune = "false"
bluestore = "true"
#osd-encrypt = "true"
#osd-encrypt-keymanager = "vault"
}
}
2024-05-12 13:43:53 +00:00
resource "juju_machine" "ceph-mon" {
count = var.num_units
2024-05-07 19:23:43 +00:00
model = var.model-name
2024-05-12 13:43:53 +00:00
placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index]].machine_id])
constraints = "spaces=oam,ceph-access,ceph-replica"
2024-05-02 20:44:41 +00:00
}
resource "juju_application" "ceph-mon" {
name = "ceph-mon"
model = var.model-name
charm {
name = "ceph-mon"
2024-05-12 13:43:53 +00:00
channel = var.ceph-channel
}
2024-05-12 13:43:53 +00:00
units = var.num_units
2024-05-12 13:43:53 +00:00
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, 0, var.num_units+1) :
juju_machine.ceph-mon[index].machine_id
2024-05-02 20:44:41 +00:00
]))}"
endpoint_bindings = [{
2024-05-07 19:23:43 +00:00
space = var.oam-space
2024-05-02 20:44:41 +00:00
},{
endpoint = "public"
2024-05-07 19:23:43 +00:00
space = var.ceph-public-space
2024-05-02 20:44:41 +00:00
},{
endpoint = "osd"
2024-05-07 19:23:43 +00:00
space = var.ceph-public-space
2024-05-02 20:44:41 +00:00
},{
endpoint = "client"
2024-05-07 19:23:43 +00:00
space = var.ceph-public-space
},{
2024-05-02 20:44:41 +00:00
endpoint = "admin"
2024-05-07 19:23:43 +00:00
space = var.ceph-public-space
2024-05-02 20:44:41 +00:00
},{
endpoint = "cluster"
2024-05-07 19:23:43 +00:00
space = var.ceph-cluster-space
2024-05-02 20:44:41 +00:00
}]
config = {
2024-05-07 19:23:43 +00:00
expected-osd-count = var.expected-osd-count
source = var.openstack-origin
monitor-count = var.expected-mon-count
customize-failure-domain = true
}
}
2024-05-12 13:43:53 +00:00
resource "juju_machine" "ceph-rgw" {
count = var.num_units
2024-05-07 19:23:43 +00:00
model = var.model-name
2024-05-12 13:43:53 +00:00
placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index]].machine_id])
constraints = "spaces=oam,ceph-access"
2024-05-02 20:44:41 +00:00
}
resource "juju_application" "ceph-radosgw" {
name = "ceph-radosgw"
model = var.model-name
charm {
name = "ceph-radosgw"
2024-05-12 13:43:53 +00:00
channel = var.ceph-channel
}
2024-05-12 13:43:53 +00:00
units = var.num_units
2024-05-12 13:43:53 +00:00
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, 0, var.num_units+1) :
juju_machine.ceph-rgw[index].machine_id
2024-05-02 20:44:41 +00:00
]))}"
endpoint_bindings = [{
2024-05-07 19:23:43 +00:00
space = var.oam-space
},{
2024-05-07 19:23:43 +00:00
space = var.public-space
endpoint = "public"
},{
2024-05-07 19:23:43 +00:00
space = var.admin-space
endpoint = "admin"
},{
2024-05-07 19:23:43 +00:00
space = var.internal-space
endpoint = "internal"
},{
2024-05-07 19:23:43 +00:00
space = var.ceph-public-space
endpoint = "mon"
}]
config = {
2024-05-07 19:23:43 +00:00
source = var.openstack-origin
vip = var.vips["radosgw"]
operator-roles = "Member,admin"
region = var.openstack-region
os-admin-hostname = "swift-internal.example.com"
os-internal-hostname = "swift-internal.example.com"
os-public-hostname = "swift.example.com"
}
}
resource "juju_application" "hacluster-radosgw" {
name = "hacluster-radosgw"
model = var.model-name
charm {
name = "hacluster"
2024-05-12 13:43:53 +00:00
channel = var.hacluster-channel
}
2024-05-02 20:44:41 +00:00
units = 0
}
resource "juju_integration" "osd-mon" {
model = var.model-name
application {
2024-05-07 19:23:43 +00:00
name = juju_application.ceph-osd.name
endpoint = "mon"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.ceph-mon.name
endpoint = "osd"
}
}
resource "juju_integration" "rgw-mon" {
model = var.model-name
application {
2024-05-07 19:23:43 +00:00
name = juju_application.ceph-radosgw.name
endpoint = "mon"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.ceph-mon.name
endpoint = "radosgw"
}
}
resource "juju_integration" "rgw-ha" {
model = var.model-name
application {
2024-05-07 19:23:43 +00:00
name = juju_application.ceph-radosgw.name
endpoint = "ha"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.hacluster-radosgw.name
endpoint = "ha"
}
}
resource "juju_integration" "rgw-keystone" {
model = var.model-name
application {
2024-05-07 19:23:43 +00:00
name = juju_application.ceph-radosgw.name
endpoint = "identity-service"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.keystone.name
endpoint = "identity-service"
}
}