Update jammy TF modules to current deployment

This introduces multiple fixes as well as modularising mysql-innodb-cluster
and vault
This commit is contained in:
2026-02-16 13:15:51 +00:00
parent f9c055eae3
commit bd563a7f82
18 changed files with 408 additions and 64 deletions
+1 -1
View File
@@ -23,5 +23,5 @@ resource "juju_model" "openstack" {
resource "juju_ssh_key" "aarsa4096canonical" {
model = juju_model.openstack.name
payload = file("/home/arif/.ssh/aarsa4096canonical.pub")
payload = file("/home/arif.ali@canonical.com/.ssh/aarsa4096canonical.pub")
}
+45 -1
View File
@@ -9,6 +9,15 @@ module "rabbitmq-server" {
model-name = var.model-name
}
module "mysql-innodb-cluster" {
source = "./modules/mysql-innodb-cluster"
# Common variables
controller_ids = var.controller_ids
all_machines = juju_machine.all_machines
model-name = var.model-name
}
module "keystone" {
source = "./modules/keystone"
@@ -54,7 +63,7 @@ module "heat" {
controller_ids = var.controller_ids
all_machines = juju_machine.all_machines
model-name = var.model-name
#public-space = var.public-space
public-space = var.public-space
# Dependancies
keystone_app = module.keystone.keystone.name
@@ -222,3 +231,38 @@ module "nova-compute-kvm-dpdk" {
cinder-ceph_app = module.cinder.cinder-ceph.name
rabbitmq-server_app = module.rabbitmq-server.rabbitmq-server.name
}
module "vault" {
source = "./modules/vault"
# Common variables
controller_ids = var.controller_ids
all_machines = juju_machine.all_machines
model-name = var.model-name
cert_apps = [
"ceph-radosgw",
"cinder",
"glance",
"heat",
"keystone",
"mysql-innodb-cluster",
"neutron-api",
"neutron-api-plugin-ovn",
"nova-cloud-controller",
"openstack-dashboard",
"ovn-central",
"ovn-chassis-kvm",
"ovn-chassis-dpdk",
"placement",
]
# Common variables
sdn_ids = var.sdn_ids
vips = var.vips
# Application Variables
nagios-context = var.nagios-context
# Dependancies
ceph-osd_app = juju_application.ceph-osd.name
}
+3 -3
View File
@@ -128,13 +128,13 @@ resource "juju_integration" "nrpe-host-integration" {
locals {
nrpe_apps_info = [
"nrpe-cont",
"nrpe-container",
"nrpe-host",
]
}
resource "juju_integration" "nrpe-cos" {
for_each = toset(local.host_apps)
for_each = toset(local.nrpe_apps_info)
model = juju_model.openstack.name
@@ -144,6 +144,6 @@ resource "juju_integration" "nrpe-cos" {
}
application {
offer_url = juju_offer.cos_proxy.url
offer_url = juju_offer.cos-proxy.url
}
}
-1
View File
@@ -1 +0,0 @@
../00-init.tf
+8
View File
@@ -0,0 +1,8 @@
terraform {
required_providers {
juju = {
version = "~> 1.2.0"
source = "juju/juju"
}
}
}
+3 -3
View File
@@ -52,9 +52,9 @@ resource "juju_application" "graylog-mongodb" {
space = var.oam-space
}]
config = {
nagios_context = var.nagios-context
}
#config = {
# nagios_context = var.nagios-context
#}
}
resource "juju_integration" "graylog-mongodb" {
@@ -2,6 +2,7 @@ resource "juju_machine" "prometheus" {
model = juju_model.lma.name
placement = join(":", ["lxd", juju_machine.lma_machines["201"].machine_id])
constraints = "spaces=oam"
base = var.default-base
}
resource "juju_application" "prometheus" {
+16 -2
View File
@@ -2,6 +2,7 @@ resource "juju_machine" "cos-proxy" {
model = juju_model.lma.name
placement = join(":", ["lxd", juju_machine.lma_machines["202"].machine_id])
constraints = "spaces=oam"
base = var.default-base
}
resource "juju_application" "cos-proxy" {
@@ -17,16 +18,29 @@ resource "juju_application" "cos-proxy" {
units = 1
placement = juju_machine.prometheus.machine_id
placement = juju_machine.cos-proxy.machine_id
endpoint_bindings = [{
space = var.oam-space
}]
}
resource "juju_offer" "cosy-proxy" {
resource "juju_offer" "cos-proxy" {
model = juju_model.lma.name
application_name = juju_application.cos-proxy.name
endpoint = "monitors"
}
resource "juju_integration" "cos-proxy-prometheus" {
model = juju_model.lma.name
application {
name = juju_application.cos-proxy.name
endpoint = "downstream-prometheus-scrape"
}
application {
offer_url = "admin/cos3.prometheus-scrape-config"
}
}
@@ -0,0 +1,3 @@
output "cinder-lvm" {
value = juju_application.cinder-lvm
}
@@ -38,7 +38,7 @@ variable default-series {
variable glance-channel {
type = string
default = "yogastable"
default = "yoga/stable"
}
variable glance-revision {
@@ -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" "mysql" {
resource "juju_machine" "mysql-innodb-cluster" {
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" "mysql-innodb-cluster" {
name = "mysql-innodb-cluster"
name = var.app-name
model = var.model-name
charm {
name = "mysql-innodb-cluster"
channel = var.mysql-channel
channel = var.mysql-innodb-cluster-channel
base = var.default-base
}
machines = [
for res in juju_machine.mysql :
for res in juju_machine.mysql-innodb-cluster :
res.machine_id
]
@@ -31,12 +31,5 @@ resource "juju_application" "mysql-innodb-cluster" {
space = var.internal-space
}]
config = {
source = var.openstack-origin
wait-timeout = "3600"
enable-binlogs = "false"
snapd_refresh = "max"
max-connections = var.mysql-connections
tuning-level = var.mysql-tuning-level
}
config = local.mysql-config
}
@@ -0,0 +1,3 @@
output "mysql-innodb-cluster" {
value = juju_application.mysql-innodb-cluster
}
@@ -0,0 +1,128 @@
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 mysql-innodb-cluster-channel {
type = string
default = "8.0/stable"
}
variable mysql-innodb-cluster-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 app-name {
type = string
default = "mysql-innodb-cluster"
}
variable mysql-connections {
type = string
default = "4000"
}
variable mysql-tuning-level {
type = string
default = "safest"
}
variable mysql-innodb-cluster-config-overrides {
type = map(string)
default = {}
}
locals {
base-mysql-config = {
source = var.openstack-origin
wait-timeout = "3600"
enable-binlogs = "false"
snapd_refresh = "max"
max-connections = var.mysql-connections
tuning-level = var.mysql-tuning-level
}
mysql-config = merge(
local.base-mysql-config,
var.mysql-innodb-cluster-config-overrides
)
}
@@ -0,0 +1,8 @@
terraform {
required_providers {
juju = {
version = "~> 0.19.0"
source = "registry.terraform.io/juju/juju"
}
}
}
@@ -1,20 +1,20 @@
resource "juju_machine" "vault" {
count = var.num_units
model = var.model-name
placement = join(":",["lxd",juju_machine.all_machines[var.sdn_ids[count.index]].machine_id])
placement = join(":",["lxd",var.all_machines[var.sdn_ids[count.index]].machine_id])
constraints = "spaces=oam"
}
resource "juju_application" "vault" {
name = "vault"
name = var.app-name
model = var.model-name
charm {
name = "vault"
channel = var.vault_channel
channel = var.vault-channel
base = var.default-base
revision = 319
#revision = var.vault-revision
}
machines = [
@@ -22,32 +22,28 @@ resource "juju_application" "vault" {
res.machine_id
]
config = {
vip = var.vips["vault"]
nagios_context = var.nagios-context
auto-generate-root-ca-cert = "true"
}
config = local.vault-config
}
module "vault-mysql-router" {
source = "./modules/mysql-router"
source = "../mysql-router"
sub-name = juju_application.vault.name
model-name = juju_model.openstack.name
model-name = var.model-name
}
module "vault-hacluster" {
source = "./modules/hacluster"
source = "../hacluster"
sub-name = juju_application.vault.name
model-name = juju_model.openstack.name
model-name = var.model-name
}
resource "juju_machine" "etcd" {
count = var.num_units
model = var.model-name
placement = join(":",["lxd",juju_machine.all_machines[var.sdn_ids[count.index]].machine_id])
placement = join(":",["lxd",var.all_machines[var.sdn_ids[count.index]].machine_id])
constraints = "spaces=oam"
}
@@ -58,7 +54,7 @@ resource "juju_application" "etcd" {
charm {
name = "etcd"
channel = var.etcd_channel
channel = var.etcd-channel
base = var.default-base
#revision = var.etcd_revision
}
@@ -85,7 +81,7 @@ resource "juju_application" "etcd" {
resource "juju_machine" "easyrsa" {
model = var.model-name
placement = join(":",["lxd",juju_machine.all_machines["402"].machine_id])
placement = join(":",["lxd",var.all_machines[var.sdn_ids[0]].machine_id])
constraints = "spaces=oam"
}
@@ -96,7 +92,7 @@ resource "juju_application" "easyrsa" {
charm {
name = "easyrsa"
channel = var.easyrsa_channel
channel = var.easyrsa-channel
base = var.default-base
}
@@ -145,33 +141,13 @@ resource "juju_integration" "vault-ceph" {
}
application {
name = juju_application.ceph-osd.name
name = var.ceph-osd_app
endpoint = "secrets-storage"
}
}
locals {
cert_apps = [
"ceph-radosgw",
"cinder",
"glance",
"heat",
"keystone",
"mysql-innodb-cluster",
"neutron-api",
"neutron-api-plugin-ovn",
"nova-cloud-controller",
"openstack-dashboard",
"ovn-central",
"ovn-chassis-kvm",
"ovn-chassis-dpdk",
"placement",
]
}
resource "juju_integration" "vault-cert" {
for_each = toset(local.cert_apps)
for_each = toset(var.cert_apps)
model = var.model-name
@@ -0,0 +1,3 @@
output "vault" {
value = juju_application.vault
}
@@ -0,0 +1,155 @@
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 sdn_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 vault-channel {
type = string
default = "1.8/stable"
}
variable vault-revision {
type = string
default = ""
}
variable etcd-channel {
type = string
default = "1.29/stable"
}
variable easyrsa-channel {
type = string
default = "latest/stable"
}
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 nagios-context {
type = string
default = ""
}
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 = "vault"
}
variable vips {
type = map(string)
default = {}
}
variable cert_apps {
type = list(string)
default = []
}
variable ceph-osd_app {
type = string
default = "ceph-osd"
}
variable vault-config-overrides {
type = map(string)
default = {}
}
locals {
base-vault-config = {
vip = var.vips["vault"]
nagios_context = var.nagios-context
auto-generate-root-ca-cert = "true"
}
vault-config = merge(
local.base-vault-config,
var.vault-config-overrides
)
}
+1
View File
@@ -1,3 +1,4 @@
cloud = "home"
model-name = "cpe-jammy"
machines = [