modularise placement and memcached
This commit is contained in:
@@ -52,6 +52,26 @@ module "glance" {
|
||||
rabbitmq-server_app = module.rabbitmq-server.rabbitmq-server.name
|
||||
}
|
||||
|
||||
module "placement" {
|
||||
source = "./modules/placement"
|
||||
|
||||
# Placement variables
|
||||
placement-channel = var.openstack-channel
|
||||
|
||||
# Common variables
|
||||
vips = var.vips
|
||||
controller_ids = var.controller_ids
|
||||
all_machines = juju_machine.all_machines
|
||||
model-name = var.model-name
|
||||
public-space = var.public-space
|
||||
internal-space = var.internal-space
|
||||
admin-space = var.admin-space
|
||||
|
||||
# Dependancies
|
||||
keystone_app = module.keystone.keystone.name
|
||||
novacc_app = juju_application.nova-cloud-controller.name
|
||||
}
|
||||
|
||||
module "heat" {
|
||||
source = "./modules/heat"
|
||||
|
||||
@@ -266,3 +286,16 @@ module "vault" {
|
||||
# Dependancies
|
||||
ceph-osd_app = juju_application.ceph-osd.name
|
||||
}
|
||||
|
||||
module "memcached" {
|
||||
source = "./modules/memcached"
|
||||
|
||||
# Common variables
|
||||
controller_ids = var.controller_ids
|
||||
all_machines = juju_machine.all_machines
|
||||
model-name = var.model-name
|
||||
|
||||
# Dependancies
|
||||
novacc_app = juju_application.nova-cloud-controller.name
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ resource "juju_application" "cinder-ceph" {
|
||||
|
||||
config = {
|
||||
restrict-ceph-pools = "false"
|
||||
rbd-pool-name = var.ceph-pool==""? null : var.ceph-pool
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
8
juju/home-maas-jammy/modules/memcached/init.tf
Normal file
8
juju/home-maas-jammy/modules/memcached/init.tf
Normal file
@@ -0,0 +1,8 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
juju = {
|
||||
version = "~> 0.19.0"
|
||||
source = "registry.terraform.io/juju/juju"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,23 @@
|
||||
resource "juju_machine" "memcache" {
|
||||
resource "juju_machine" "memcached" {
|
||||
count = var.num_units
|
||||
model = var.model-name
|
||||
placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index]].machine_id])
|
||||
placement = join(":", ["lxd", var.all_machines[var.controller_ids[count.index]].machine_id])
|
||||
constraints = "spaces=oam"
|
||||
}
|
||||
|
||||
resource "juju_application" "memcached" {
|
||||
name = "memcached"
|
||||
name = var.app-name
|
||||
|
||||
model = var.model-name
|
||||
|
||||
charm {
|
||||
name = "memcached"
|
||||
channel = "latest/stable"
|
||||
channel = var.memcache-channel
|
||||
base = var.default-base
|
||||
}
|
||||
|
||||
machines = [
|
||||
for res in juju_machine.memcache :
|
||||
for res in juju_machine.memcached :
|
||||
res.machine_id
|
||||
]
|
||||
|
||||
@@ -29,17 +29,15 @@ resource "juju_application" "memcached" {
|
||||
space = var.internal-space
|
||||
}]
|
||||
|
||||
config = {
|
||||
allow-ufw-ip6-softfail = "true"
|
||||
}
|
||||
config = local.memcached-config
|
||||
}
|
||||
|
||||
resource "juju_integration" "nova-cloud-controller-memcache" {
|
||||
resource "juju_integration" "nova-cc-memcached" {
|
||||
|
||||
model = var.model-name
|
||||
|
||||
application {
|
||||
name = juju_application.nova-cloud-controller.name
|
||||
name = var.novacc_app
|
||||
endpoint = "memcache"
|
||||
}
|
||||
|
||||
3
juju/home-maas-jammy/modules/memcached/outputs.tf
Normal file
3
juju/home-maas-jammy/modules/memcached/outputs.tf
Normal file
@@ -0,0 +1,3 @@
|
||||
output "memcached" {
|
||||
value = juju_application.memcached
|
||||
}
|
||||
88
juju/home-maas-jammy/modules/memcached/variables.tf
Normal file
88
juju/home-maas-jammy/modules/memcached/variables.tf
Normal file
@@ -0,0 +1,88 @@
|
||||
variable num_units {
|
||||
type = number
|
||||
default = 3
|
||||
}
|
||||
|
||||
variable "all_machines" {
|
||||
description = "Machines"
|
||||
type = map(object({
|
||||
base = string
|
||||
constraints = string
|
||||
id = string
|
||||
machine_id = string
|
||||
model = string
|
||||
name = string
|
||||
series = string
|
||||
}))
|
||||
}
|
||||
|
||||
variable controller_ids {
|
||||
type = list(string)
|
||||
default = []
|
||||
}
|
||||
|
||||
variable model-name {
|
||||
type = string
|
||||
default = "openstack"
|
||||
}
|
||||
|
||||
variable default-base {
|
||||
type = string
|
||||
default = "ubuntu@22.04"
|
||||
}
|
||||
|
||||
variable default-series {
|
||||
type = string
|
||||
default = "jammy"
|
||||
}
|
||||
|
||||
variable memcache-channel {
|
||||
type = string
|
||||
default = "latest/stable"
|
||||
}
|
||||
|
||||
variable memcache-revision {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable oam-space {
|
||||
type = string
|
||||
default = "oam"
|
||||
}
|
||||
|
||||
variable admin-space {
|
||||
type = string
|
||||
default = "admin"
|
||||
}
|
||||
|
||||
variable internal-space {
|
||||
type = string
|
||||
default = "internal"
|
||||
}
|
||||
|
||||
variable app-name {
|
||||
type = string
|
||||
default = "memcached"
|
||||
}
|
||||
|
||||
variable novacc_app {
|
||||
type = string
|
||||
default = "nova-cloud-controller"
|
||||
}
|
||||
|
||||
variable memcached-config-overrides {
|
||||
type = map(string)
|
||||
default = {}
|
||||
}
|
||||
|
||||
locals {
|
||||
base-memcached-config = {
|
||||
allow-ufw-ip6-softfail = "true"
|
||||
}
|
||||
|
||||
memcached-config = merge(
|
||||
local.base-memcached-config,
|
||||
var.memcached-config-overrides
|
||||
)
|
||||
}
|
||||
8
juju/home-maas-jammy/modules/placement/init.tf
Normal file
8
juju/home-maas-jammy/modules/placement/init.tf
Normal file
@@ -0,0 +1,8 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
juju = {
|
||||
version = "~> 0.19.0"
|
||||
source = "registry.terraform.io/juju/juju"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
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", var.all_machines[var.controller_ids[count.index+var.num_units]].machine_id])
|
||||
constraints = "spaces=oam"
|
||||
}
|
||||
|
||||
resource "juju_application" "placement" {
|
||||
name = "placement"
|
||||
name = var.app-name
|
||||
|
||||
model = var.model-name
|
||||
|
||||
charm {
|
||||
name = "placement"
|
||||
channel = var.openstack-channel
|
||||
channel = var.placement-channel
|
||||
base = var.default-base
|
||||
}
|
||||
|
||||
@@ -37,29 +37,21 @@ resource "juju_application" "placement" {
|
||||
space = var.internal-space
|
||||
}]
|
||||
|
||||
config = {
|
||||
worker-multiplier = var.worker-multiplier
|
||||
openstack-origin = var.openstack-origin
|
||||
vip = var.vips["placement"]
|
||||
#os-admin-hostname = "${join(".",[var.fqdn-admin["placement"],var.domain])}"
|
||||
#os-internal-hostname = "${join(".",[var.fqdn-int["placement"],var.domain])}"
|
||||
#os-public-hostname = "${join(".",[var.fqdn-pub["placement"],var.domain])}"
|
||||
|
||||
}
|
||||
config = local.placement-config
|
||||
}
|
||||
|
||||
module "placement-mysql-router" {
|
||||
source = "./modules/mysql-router"
|
||||
source = "../mysql-router"
|
||||
|
||||
sub-name = juju_application.placement.name
|
||||
model-name = juju_model.openstack.name
|
||||
model-name = var.model-name
|
||||
}
|
||||
|
||||
module "placement-hacluster" {
|
||||
source = "./modules/hacluster"
|
||||
source = "../hacluster"
|
||||
|
||||
sub-name = juju_application.placement.name
|
||||
model-name = juju_model.openstack.name
|
||||
model-name = var.model-name
|
||||
}
|
||||
|
||||
resource "juju_integration" "placement-keystone" {
|
||||
@@ -72,7 +64,7 @@ resource "juju_integration" "placement-keystone" {
|
||||
}
|
||||
|
||||
application {
|
||||
name = module.keystone.keystone.name
|
||||
name = var.keystone_app
|
||||
endpoint = "identity-service"
|
||||
}
|
||||
}
|
||||
@@ -87,7 +79,7 @@ resource "juju_integration" "placement-nova" {
|
||||
}
|
||||
|
||||
application {
|
||||
name = juju_application.nova-cloud-controller.name
|
||||
name = var.novacc_app
|
||||
endpoint = "placement"
|
||||
}
|
||||
}
|
||||
3
juju/home-maas-jammy/modules/placement/outputs.tf
Normal file
3
juju/home-maas-jammy/modules/placement/outputs.tf
Normal file
@@ -0,0 +1,3 @@
|
||||
output "placement" {
|
||||
value = juju_application.placement
|
||||
}
|
||||
135
juju/home-maas-jammy/modules/placement/variables.tf
Normal file
135
juju/home-maas-jammy/modules/placement/variables.tf
Normal file
@@ -0,0 +1,135 @@
|
||||
variable num_units {
|
||||
type = number
|
||||
default = 3
|
||||
}
|
||||
|
||||
variable "all_machines" {
|
||||
description = "Machines"
|
||||
type = map(object({
|
||||
base = string
|
||||
constraints = string
|
||||
id = string
|
||||
machine_id = string
|
||||
model = string
|
||||
name = string
|
||||
series = string
|
||||
}))
|
||||
}
|
||||
|
||||
variable controller_ids {
|
||||
type = list(string)
|
||||
default = []
|
||||
}
|
||||
|
||||
variable model-name {
|
||||
type = string
|
||||
default = "openstack"
|
||||
}
|
||||
|
||||
variable default-base {
|
||||
type = string
|
||||
default = "ubuntu@22.04"
|
||||
}
|
||||
|
||||
variable default-series {
|
||||
type = string
|
||||
default = "jammy"
|
||||
}
|
||||
|
||||
variable placement-channel {
|
||||
type = string
|
||||
default = "yoga/stable"
|
||||
}
|
||||
|
||||
variable placement-revision {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable oam-space {
|
||||
type = string
|
||||
default = "oam"
|
||||
}
|
||||
|
||||
variable admin-space {
|
||||
type = string
|
||||
default = "admin"
|
||||
}
|
||||
|
||||
variable public-space {
|
||||
type = string
|
||||
default = "public"
|
||||
}
|
||||
|
||||
variable internal-space {
|
||||
type = string
|
||||
default = "internal"
|
||||
}
|
||||
|
||||
variable ceph-public-space {
|
||||
type = string
|
||||
default = "ceph-public"
|
||||
}
|
||||
|
||||
variable ceph-cluster-space {
|
||||
type = string
|
||||
default = "ceph-cluster"
|
||||
}
|
||||
|
||||
variable overlay-space {
|
||||
type = string
|
||||
default = "overlay"
|
||||
}
|
||||
|
||||
variable openstack-origin {
|
||||
type = string
|
||||
default = "distro"
|
||||
}
|
||||
|
||||
variable openstack-region {
|
||||
type = string
|
||||
default = "RegionOne"
|
||||
}
|
||||
|
||||
variable worker-multiplier {
|
||||
type = string
|
||||
default = "0.25"
|
||||
}
|
||||
|
||||
variable app-name {
|
||||
type = string
|
||||
default = "placement"
|
||||
}
|
||||
|
||||
variable vips {
|
||||
type = map(string)
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable keystone_app {
|
||||
type = string
|
||||
default = "keystone"
|
||||
}
|
||||
|
||||
variable novacc_app {
|
||||
type = string
|
||||
default = "nova-cloud-controller"
|
||||
}
|
||||
|
||||
variable placement-config-overrides {
|
||||
type = map(string)
|
||||
default = {}
|
||||
}
|
||||
|
||||
locals {
|
||||
base-placement-config = {
|
||||
worker-multiplier = var.worker-multiplier
|
||||
openstack-origin = var.openstack-origin
|
||||
vip = var.vips["placement"]
|
||||
}
|
||||
|
||||
placement-config = merge(
|
||||
local.base-placement-config,
|
||||
var.placement-config-overrides
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user