diff --git a/juju/home-maas-jammy/00-variables.tf b/juju/home-maas-jammy/00-variables.tf index 7ac4786..75e6b6c 100644 --- a/juju/home-maas-jammy/00-variables.tf +++ b/juju/home-maas-jammy/00-variables.tf @@ -99,6 +99,15 @@ variable "microk8s-machines" { default = [] } +variable "landscape-machines" { + type = list(object({ + machine_id = number + constraints = string + base = optional(string) + })) + default = [] +} + variable "cinder-lvm-machines" { type = list(object({ machine_id = number @@ -138,6 +147,11 @@ variable cos-model-name { default = "cos" } +variable landscape-model-name { + type = string + default = "landscape" +} + variable openstack-origin { type = string default = "distro" diff --git a/juju/home-maas-jammy/01-cloud.tf b/juju/home-maas-jammy/01-cloud.tf index 6747a71..d549382 100644 --- a/juju/home-maas-jammy/01-cloud.tf +++ b/juju/home-maas-jammy/01-cloud.tf @@ -23,5 +23,6 @@ resource "juju_model" "openstack" { resource "juju_ssh_key" "aarsa4096canonical" { model = juju_model.openstack.name - payload = file("/home/arif.ali@canonical.com/.ssh/aarsa4096canonical.pub") + #payload = file("/home/arif.ali@canonical.com/.ssh/aarsa4096canonical.pub") + payload = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDHuq15h5hmPijTuICx4tO9DFYro++XDigw9Jh1osYrYJxTU4jwhRVvJGqrLOfTG8tl1VMAs4xQ6RGDVsWmbOpSfjtQ93D2Ovz6AnNQx+cEJwOA7DzE3MhDWHijKu5ev5oq/tWkW9wEV0NTzsPyOsqUd8bQIRn86bb7X9/bPKzXJ4r4+vdtF3bRhqEi7gdFGedUiQ/OEGVBfKxxt++jejs6vwcU7ljiZnvECXA6myo5e+nJLxNND2wF1zhjncYwJLX6EdU07K3ZRihcDKmqFb4KE/5W2Ot7RiDcnkrANBqjl6nU8N2UiY5pTHMaCBWSDfS+kWIXiX7arqHFB9uYBCd5r8XoX6ajSn2rFlsnvHwOKQK4uZ1GcDjwImXMrFzUJ6rnmFB3kl+VVpjzyMQiviA5AOZcC4X3PonjQHYweTs6wF89YXO0pD2vzBnU/HTmsrgE22yFFq7s63oq+wlTHPlXfAxLpF3cMPaG1hrEaAwvE1BiKQ6bUT1cxg7qtK73i59YiiTNQI2Ka3mp8oxASwk7Cgr/X+NWgpbXsBQODKM6750JAt1YRlsR71jxmehCrwj16ojWlxNghF9T5hePlgWEMueJ8pPkSGKv6s07Hmf/Hgs6oBSNcr7LiTvirAyVAGV3gQCAteP9YmN7BmNGFGz4CGpBUL1/nJlADteS2IOuNQ== arif@arif-laptop" } diff --git a/juju/home-maas-jammy/04-openstack-common.tf b/juju/home-maas-jammy/04-openstack-common.tf index 0d709d9..1002c2b 100644 --- a/juju/home-maas-jammy/04-openstack-common.tf +++ b/juju/home-maas-jammy/04-openstack-common.tf @@ -6,7 +6,8 @@ module "rabbitmq-server" { # Common variables controller_ids = var.controller_ids all_machines = juju_machine.all_machines - model-name = var.model-name + model-name = juju_model.openstack.name + model-uuid = juju_model.openstack.uuid } module "mysql-innodb-cluster" { @@ -32,6 +33,27 @@ module "keystone" { public-space = var.public-space } +module "nova" { + source = "./modules/nova" + + # Nova variables + nova-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 + + # Dependancies + keystone_app = module.keystone.keystone.name + glance_app = module.glance.glance.name + rabbitmq-server_app = module.rabbitmq-server.rabbitmq-server.name + neutron_app = juju_application.neutron-api.name + memcache_app = module.memcached.memcached.name +} + module "glance" { source = "./modules/glance" @@ -69,7 +91,7 @@ module "placement" { # Dependancies keystone_app = module.keystone.keystone.name - novacc_app = juju_application.nova-cloud-controller.name + novacc_app = module.nova.nova.name } module "heat" { @@ -116,61 +138,61 @@ module "cinder" { rabbitmq-server_app = module.rabbitmq-server.rabbitmq-server.name } -module "cinder-backup" { - source = "./modules/cinder" +#module "cinder-backup" { +# source = "./modules/cinder" +# +# app-name = "cinder-backup" +# +# # Cinder variables +# cinder-channel = var.openstack-channel +# cinder-config-overrides = { +# enabled-services = "backup" +# } +# +# cinder-ceph-sub = 1 +# +# # 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.internal-space +# +# # Dependancies +# keystone_app = module.keystone.keystone.name +# ceph-mon_app = juju_application.ceph-mon.name +# rabbitmq-server_app = module.rabbitmq-server.rabbitmq-server.name +#} - app-name = "cinder-backup" - - # Cinder variables - cinder-channel = var.openstack-channel - cinder-config-overrides = { - enabled-services = "backup" - } - - cinder-ceph-sub = 1 - - # 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.internal-space - - # Dependancies - keystone_app = module.keystone.keystone.name - ceph-mon_app = juju_application.ceph-mon.name - rabbitmq-server_app = module.rabbitmq-server.rabbitmq-server.name -} - -module "cinder-lvm" { - source = "./modules/cinder" - - app-name = "cinder-volume" - - # Cinder variables - cinder-channel = var.openstack-channel - cinder-config-overrides = { - enabled-services = "volume" - } - - cinder-lvm-sub = 1 - - # 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.internal-space - - # Dependancies - keystone_app = module.keystone.keystone.name - ceph-mon_app = juju_application.ceph-mon.name - rabbitmq-server_app = module.rabbitmq-server.rabbitmq-server.name -} +#module "cinder-lvm" { +# source = "./modules/cinder" +# +# app-name = "cinder-volume" +# +# # Cinder variables +# cinder-channel = var.openstack-channel +# cinder-config-overrides = { +# enabled-services = "volume" +# } +# +# cinder-lvm-sub = 1 +# +# # 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.internal-space +# +# # Dependancies +# keystone_app = module.keystone.keystone.name +# ceph-mon_app = juju_application.ceph-mon.name +# rabbitmq-server_app = module.rabbitmq-server.rabbitmq-server.name +#} module "nova-compute-kvm" { source = "./modules/nova-compute" @@ -205,52 +227,53 @@ module "nova-compute-kvm" { glance_app = module.glance.glance.name cinder-ceph_app = module.cinder.cinder-ceph.name rabbitmq-server_app = module.rabbitmq-server.rabbitmq-server.name + nova_app = module.nova.nova.name } -module "nova-compute-kvm-dpdk" { - source = "./modules/nova-compute" - - app-name = "nova-compute-kvm-dpdk" - - ovn-chassis-app-name = "ovn-chassis-dpdk" - ovn-chassis-config = { - bridge-interface-mappings = var.data-port - ovn-bridge-mappings = var.bridge-mappings - enable-dpdk = true - dpdk-socket-cores = 1 - dpdk-socket-memory = 512 - dpdk-driver = "vfio-pci" - dpdk-runtime-libraries = "librte-net-vhost22" - #dpdk-runtime-libraries = "librte-net-virtio22" - } - - sysconfig-app-name = "sysconfig-compute-dpdk" - sysconfig-config = { - enable-iommu = "true" - governor = "performance" - enable-pti = "on" - update-grub = "true" - enable-tsx = "true" - hugepages = 256 - hugepagesz = "2M" - #default-hugepagesz = "1G" - } - - # Nova Compute variables - nova-compute-channel = var.openstack-channel - - # Common variables - compute_ids = var.dpdk_ids - all_machines = juju_machine.all_machines - model-name = var.model-name - - # Dependancies - ovn-central_app = juju_application.ovn-central.name - ceph-mon_app = juju_application.ceph-mon.name - glance_app = module.glance.glance.name - cinder-ceph_app = module.cinder.cinder-ceph.name - rabbitmq-server_app = module.rabbitmq-server.rabbitmq-server.name -} +#module "nova-compute-kvm-dpdk" { +# source = "./modules/nova-compute" +# +# app-name = "nova-compute-kvm-dpdk" +# +# ovn-chassis-app-name = "ovn-chassis-dpdk" +# ovn-chassis-config = { +# bridge-interface-mappings = var.data-port +# ovn-bridge-mappings = var.bridge-mappings +# enable-dpdk = true +# dpdk-socket-cores = 1 +# dpdk-socket-memory = 512 +# dpdk-driver = "vfio-pci" +# dpdk-runtime-libraries = "librte-net-vhost22" +# #dpdk-runtime-libraries = "librte-net-virtio22" +# } +# +# sysconfig-app-name = "sysconfig-compute-dpdk" +# sysconfig-config = { +# enable-iommu = "true" +# governor = "performance" +# enable-pti = "on" +# update-grub = "true" +# enable-tsx = "true" +# hugepages = 256 +# hugepagesz = "2M" +# #default-hugepagesz = "1G" +# } +# +# # Nova Compute variables +# nova-compute-channel = var.openstack-channel +# +# # Common variables +# compute_ids = var.dpdk_ids +# all_machines = juju_machine.all_machines +# model-name = var.model-name +# +# # Dependancies +# ovn-central_app = juju_application.ovn-central.name +# ceph-mon_app = juju_application.ceph-mon.name +# glance_app = module.glance.glance.name +# cinder-ceph_app = module.cinder.cinder-ceph.name +# rabbitmq-server_app = module.rabbitmq-server.rabbitmq-server.name +#} module "vault" { source = "./modules/vault" @@ -273,7 +296,7 @@ module "vault" { "openstack-dashboard", "ovn-central", "ovn-chassis-kvm", - "ovn-chassis-dpdk", +# "ovn-chassis-dpdk", "placement", "designate", ] @@ -299,14 +322,18 @@ module "memcached" { internal-space = var.internal-space # Dependancies - novacc_app = juju_application.nova-cloud-controller.name + novacc_app = module.nova.nova.name } module "designate" { source = "./modules/designate" designate-config-overrides = { - nameservers = "ns1.arif-ali.co.uk,ns1.arif-ali.co.uk" + nameservers = "ns1.homelab.arif-ali.co.uk." + } + + designate-bind-config-overrides = { + forwarders = "192.168.1.9;192.168.1.13" } # Common variables @@ -324,3 +351,55 @@ module "designate" { rabbitmq-server_app = module.rabbitmq-server.rabbitmq-server.name memcache_app = module.memcached.memcached.name } + +#module "ceph-fs" { +# source = "./modules/ceph-fs" +# +# # Common variables +# controller_ids = var.controller_ids +# all_machines = juju_machine.all_machines +# model-name = var.model-name +# public-space = var.public-space +# +# # Dependancies +# ceph-mon_app = juju_application.ceph-mon.name +#} + +module "ironic-api" { + source = "./modules/ironic-api" + + # Nova variables + ironic-api-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 + internal-space = var.internal-space + admin-space = var.admin-space + + # Dependancies + keystone_app = module.keystone.keystone.name + rabbitmq-server_app = module.rabbitmq-server.rabbitmq-server.name +} + +module "ironic" { + source = "./modules/ironic" + + # Nova variables + ironic-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 + + # Dependancies + keystone_app = module.keystone.keystone.name + rabbitmq-server_app = module.rabbitmq-server.rabbitmq-server.name + ironic-api_app = module.ironic-api.ironic-api.name +} diff --git a/juju/home-maas-jammy/05-ceph.tf b/juju/home-maas-jammy/05-ceph.tf index 5f85a02..84a81f1 100644 --- a/juju/home-maas-jammy/05-ceph.tf +++ b/juju/home-maas-jammy/05-ceph.tf @@ -20,7 +20,6 @@ resource "juju_application" "ceph-osd" { aa-profile-mode = "complain" customize-failure-domain = "true" autotune = "false" - bluestore = "true" osd-encrypt = "true" osd-encrypt-keymanager = "vault" } diff --git a/juju/home-maas-jammy/08-neutron.tf b/juju/home-maas-jammy/08-neutron.tf index f5aeda6..91d9089 100644 --- a/juju/home-maas-jammy/08-neutron.tf +++ b/juju/home-maas-jammy/08-neutron.tf @@ -80,6 +80,8 @@ resource "juju_application" "neutron-api" { neutron-security-groups = "true" #default-tenant-network-type = "vxlan" overlay-network-type = "gre" + dns-domain = "homelab.arif-ali.co.uk." + reverse-dns-lookup = true } } diff --git a/juju/home-maas-jammy/modules/ceph-fs/init.tf b/juju/home-maas-jammy/modules/ceph-fs/init.tf new file mode 100644 index 0000000..2efaa5b --- /dev/null +++ b/juju/home-maas-jammy/modules/ceph-fs/init.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + juju = { + version = "~> 0.19.0" + source = "registry.terraform.io/juju/juju" + } + } +} diff --git a/juju/home-maas-jammy/modules/ceph-fs/main.tf b/juju/home-maas-jammy/modules/ceph-fs/main.tf new file mode 100644 index 0000000..da8d595 --- /dev/null +++ b/juju/home-maas-jammy/modules/ceph-fs/main.tf @@ -0,0 +1,57 @@ +resource "juju_machine" "ceph-fs" { + count = var.num_units + model = var.model-name + placement = join(":", ["lxd", var.all_machines[var.controller_ids[count.index+var.num_units]].machine_id]) + constraints = "spaces=oam" +} + +resource "juju_application" "ceph-fs" { + name = var.app-name + + model = var.model-name + + charm { + name = "ceph-fs" + channel = var.ceph-fs-channel + base = var.default-base + } + + machines = [ + for res in juju_machine.ceph-fs : + res.machine_id + ] + + endpoint_bindings = [{ + space = var.oam-space + },{ + endpoint = "public" + space = var.public-space + }] + + config = local.ceph-fs-config +} + +resource "juju_integration" "ceph-fs-mon" { + + model = var.model-name + + application { + name = juju_application.ceph-fs.name + endpoint = "ceph-mds" + } + + application { + name = var.ceph-mon_app + endpoint = "mds" + } + + lifecycle { + replace_triggered_by = [ + juju_application.ceph-fs.name, + juju_application.ceph-fs.model, + juju_application.ceph-fs.constraints, + juju_application.ceph-fs.placement, + juju_application.ceph-fs.charm.name, + ] + } +} diff --git a/juju/home-maas-jammy/modules/ceph-fs/outputs.tf b/juju/home-maas-jammy/modules/ceph-fs/outputs.tf new file mode 100644 index 0000000..f76908f --- /dev/null +++ b/juju/home-maas-jammy/modules/ceph-fs/outputs.tf @@ -0,0 +1,3 @@ +output "ceph-fs" { + value = juju_application.ceph-fs +} diff --git a/juju/home-maas-jammy/modules/ceph-fs/variables.tf b/juju/home-maas-jammy/modules/ceph-fs/variables.tf new file mode 100644 index 0000000..addd60c --- /dev/null +++ b/juju/home-maas-jammy/modules/ceph-fs/variables.tf @@ -0,0 +1,122 @@ +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 ceph-fs-channel { + type = string + default = "quincy/stable" +} + +variable ceph-fs-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 = "ceph-fs" +} + +variable ceph-mon_app { + type = string + default = "ceph-mon" +} + +variable ceph-fs-config-overrides { + type = map(string) + default = {} +} + +locals { + base-ceph-fs-config = { + } + + ceph-fs-config = merge( + local.base-ceph-fs-config, + var.ceph-fs-config-overrides + ) +} diff --git a/juju/home-maas-jammy/modules/cinder/variables.tf b/juju/home-maas-jammy/modules/cinder/variables.tf index eed3a27..40c8422 100644 --- a/juju/home-maas-jammy/modules/cinder/variables.tf +++ b/juju/home-maas-jammy/modules/cinder/variables.tf @@ -96,6 +96,11 @@ variable worker-multiplier { default = "0.25" } +variable domain { + type = string + default = "openstack.local" +} + variable app-name { type = string default = "cinder" @@ -143,6 +148,9 @@ locals { use-internal-endpoints = "true" block-device = "None" glance-api-version = "2" + #os-admin-hostname = "${join(".",[var.fqdn-admin[var.app-name],var.domain])}" + #os-internal-hostname = "${join(".",[var.fqdn-int[var.app-name],var.domain])}" + #os-public-hostname = "${join(".",[var.fqdn-pub[var.app-name],var.domain])}" } cleaned-cinder-config = { diff --git a/juju/home-maas-jammy/modules/designate/main.tf b/juju/home-maas-jammy/modules/designate/main.tf index d4bbf5c..4993bff 100644 --- a/juju/home-maas-jammy/modules/designate/main.tf +++ b/juju/home-maas-jammy/modules/designate/main.tf @@ -77,13 +77,7 @@ resource "juju_application" "designate-bind" { res.machine_id ] - config = { - disable-dnssec-validation = true - forwarders = "" - recursion = true - service_ips = var.vips["designate-bind"] - use-internal-endpoints = true - } + config = local.designate-bind-config } module "designate-bind-hacluster" { diff --git a/juju/home-maas-jammy/modules/designate/variables.tf b/juju/home-maas-jammy/modules/designate/variables.tf index a928360..d3ed125 100644 --- a/juju/home-maas-jammy/modules/designate/variables.tf +++ b/juju/home-maas-jammy/modules/designate/variables.tf @@ -133,7 +133,7 @@ locals { openstack-origin = var.openstack-origin region = var.openstack-region use-internal-endpoints = "true" - vip = var.vips["designate"] + vip = var.vips[var.app-name] } designate-config = merge( @@ -141,3 +141,22 @@ locals { var.designate-config-overrides ) } + +variable designate-bind-config-overrides { + type = map(string) + default = {} +} + +locals { + base-designate-bind-config = { + #disable-dnssec-validation = "true" + #recursion = "true" + service_ips = var.vips["designate-bind"] + use-internal-endpoints = "true" + } + + designate-bind-config = merge( + local.base-designate-bind-config, + var.designate-bind-config-overrides + ) +} diff --git a/juju/home-maas-jammy/modules/glance/main.tf b/juju/home-maas-jammy/modules/glance/main.tf index 7c96d34..74a56e2 100644 --- a/juju/home-maas-jammy/modules/glance/main.tf +++ b/juju/home-maas-jammy/modules/glance/main.tf @@ -74,7 +74,7 @@ resource "juju_integration" "glance-rmq" { juju_application.glance.model, juju_application.glance.constraints, juju_application.glance.placement, - juju_application.glance.charm.name, + juju_application.glance.charm[0].name, ] } } @@ -99,7 +99,7 @@ resource "juju_integration" "glance-keystone" { juju_application.glance.model, juju_application.glance.constraints, juju_application.glance.placement, - juju_application.glance.charm.name, + juju_application.glance.charm[0].name, ] } } @@ -124,7 +124,7 @@ resource "juju_integration" "glance-ceph" { juju_application.glance.model, juju_application.glance.constraints, juju_application.glance.placement, - juju_application.glance.charm.name, + juju_application.glance.charm[0].name, ] } } @@ -149,7 +149,7 @@ resource "juju_integration" "glance-ceph" { # juju_application.glance.model, # juju_application.glance.constraints, # juju_application.glance.placement, -# juju_application.glance.charm.name, +# juju_application.glance.charm[0].name, # ] # } #} @@ -174,7 +174,7 @@ resource "juju_integration" "glance-cinder-image" { juju_application.glance.model, juju_application.glance.constraints, juju_application.glance.placement, - juju_application.glance.charm.name, + juju_application.glance.charm[0].name, ] } } diff --git a/juju/home-maas-jammy/modules/ironic-api/init.tf b/juju/home-maas-jammy/modules/ironic-api/init.tf new file mode 100644 index 0000000..2efaa5b --- /dev/null +++ b/juju/home-maas-jammy/modules/ironic-api/init.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + juju = { + version = "~> 0.19.0" + source = "registry.terraform.io/juju/juju" + } + } +} diff --git a/juju/home-maas-jammy/modules/ironic-api/main.tf b/juju/home-maas-jammy/modules/ironic-api/main.tf new file mode 100644 index 0000000..4156917 --- /dev/null +++ b/juju/home-maas-jammy/modules/ironic-api/main.tf @@ -0,0 +1,102 @@ +resource "juju_machine" "ironic-api" { + count = var.num_units + model = var.model-name + placement = join(":", ["lxd", var.all_machines[var.controller_ids[count.index]].machine_id]) + constraints = "spaces=oam" +} + +resource "juju_application" "ironic-api" { + name = var.app-name + + model = var.model-name + + charm { + name = "ironic-api" + channel = var.ironic-api-channel + base = var.default-base + } + + machines = [ + for res in juju_machine.ironic-api : + res.machine_id + ] + + endpoint_bindings = [{ + space = var.oam-space + },{ + endpoint = "admin" + space = var.admin-space + },{ + endpoint = "internal" + space = var.internal-space + },{ + endpoint = "shared-db" + space = var.internal-space + }] + + config = local.ironic-api-config +} + +module "ironic-api-mysql-router" { + source = "../mysql-router" + + sub-name = var.app-name + model-name = var.model-name +} + +module "ironic-api-hacluster" { + source = "../hacluster" + + sub-name = var.app-name + model-name = var.model-name +} + +resource "juju_integration" "ironic-api-rmq" { + + model = var.model-name + + application { + name = juju_application.ironic-api.name + endpoint = "amqp" + } + + application { + name = var.rabbitmq-server_app + endpoint = "amqp" + } + + lifecycle { + replace_triggered_by = [ + juju_application.ironic-api.name, + juju_application.ironic-api.model, + juju_application.ironic-api.constraints, + juju_application.ironic-api.placement, + juju_application.ironic-api.charm[0].name, + ] + } +} + +resource "juju_integration" "ironic-api-keystone" { + + model = var.model-name + + application { + name = juju_application.ironic-api.name + endpoint = "identity-service" + } + + application { + name = var.keystone_app + endpoint = "identity-service" + } + + lifecycle { + replace_triggered_by = [ + juju_application.ironic-api.name, + juju_application.ironic-api.model, + juju_application.ironic-api.constraints, + juju_application.ironic-api.placement, + juju_application.ironic-api.charm[0].name, + ] + } +} diff --git a/juju/home-maas-jammy/modules/ironic-api/outputs.tf b/juju/home-maas-jammy/modules/ironic-api/outputs.tf new file mode 100644 index 0000000..3b84126 --- /dev/null +++ b/juju/home-maas-jammy/modules/ironic-api/outputs.tf @@ -0,0 +1,3 @@ +output "ironic-api" { + value = juju_application.ironic-api +} diff --git a/juju/home-maas-jammy/modules/ironic-api/variables.tf b/juju/home-maas-jammy/modules/ironic-api/variables.tf new file mode 100644 index 0000000..afdb71d --- /dev/null +++ b/juju/home-maas-jammy/modules/ironic-api/variables.tf @@ -0,0 +1,141 @@ +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 ironic-api-channel { + type = string + default = "yoga/stable" +} + +variable ironic-api-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 = "ironic-api" +} + +variable vips { + type = map(string) + default = {} +} + +variable keystone_app { + type = string + default = "keystone" +} + +variable rabbitmq-server_app { + type = string + default = "rabbitmq-server" +} + +variable vault_app { + type = string + default = "vault" +} + +variable ironic-api-config-overrides { + type = map(string) + default = {} +} + +locals { + base-ironic-api-config = { + openstack-origin = var.openstack-origin + region = var.openstack-region + vip = var.vips[var.app-name] + use-internal-endpoints = "true" + } + + ironic-api-config = merge( + local.base-ironic-api-config, + var.ironic-api-config-overrides + ) +} diff --git a/juju/home-maas-jammy/modules/ironic/init.tf b/juju/home-maas-jammy/modules/ironic/init.tf new file mode 100644 index 0000000..2efaa5b --- /dev/null +++ b/juju/home-maas-jammy/modules/ironic/init.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + juju = { + version = "~> 0.19.0" + source = "registry.terraform.io/juju/juju" + } + } +} diff --git a/juju/home-maas-jammy/modules/ironic/main.tf b/juju/home-maas-jammy/modules/ironic/main.tf new file mode 100644 index 0000000..cf2f797 --- /dev/null +++ b/juju/home-maas-jammy/modules/ironic/main.tf @@ -0,0 +1,88 @@ +resource "juju_machine" "ironic" { + count = var.num_units + model = var.model-name + placement = join(":", ["lxd", var.all_machines[var.controller_ids[count.index+var.num_units]].machine_id]) + constraints = "spaces=oam" +} + +resource "juju_application" "ironic-conductor" { + name = var.app-name + + model = var.model-name + + charm { + name = "ironic-conductor" + channel = var.ironic-channel + base = var.default-base + } + + machines = [ + for res in juju_machine.ironic : + res.machine_id + ] + + endpoint_bindings = [{ + space = var.oam-space + },{ + endpoint = "internal" + space = var.internal-space + },{ + endpoint = "shared-db" + space = var.internal-space + }] + + config = local.ironic-config +} + +module "ironic-mysql-router" { + source = "../mysql-router" + + sub-name = juju_application.ironic-conductor.name + model-name = var.model-name +} + +resource "juju_integration" "ironic-conductor-rmq" { + + model = var.model-name + + application { + name = juju_application.ironic-conductor.name + endpoint = "amqp" + } + + application { + name = var.rabbitmq-server_app + endpoint = "amqp" + } +} + +resource "juju_integration" "ironic-conductor-keystone" { + + model = var.model-name + + application { + name = juju_application.ironic-conductor.name + endpoint = "identity-credentials" + } + + application { + name = var.keystone_app + endpoint = "identity-credentials" + } +} + + +resource "juju_integration" "ironic-conductor-api" { + + model = var.model-name + + application { + name = juju_application.ironic-conductor.name + endpoint = "ironic-api" + } + + application { + name = var.ironic-api_app + endpoint = "ironic-api" + } +} diff --git a/juju/home-maas-jammy/modules/ironic/outputs.tf b/juju/home-maas-jammy/modules/ironic/outputs.tf new file mode 100644 index 0000000..776a16c --- /dev/null +++ b/juju/home-maas-jammy/modules/ironic/outputs.tf @@ -0,0 +1,3 @@ +output "ironic" { + value = juju_application.ironic-conductor +} diff --git a/juju/home-maas-jammy/modules/ironic/variables.tf b/juju/home-maas-jammy/modules/ironic/variables.tf new file mode 100644 index 0000000..2f425db --- /dev/null +++ b/juju/home-maas-jammy/modules/ironic/variables.tf @@ -0,0 +1,159 @@ +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 ironic-channel { + type = string + default = "yoga/stable" +} + +variable ironic-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 = "ironic-conductor" +} + +variable vips { + type = map(string) + default = {} +} + +variable ironic-config-overrides { + type = map(string) + default = {} +} + +locals { + base-ironic-config = { + openstack-origin = var.openstack-origin + max-tftp-block-size = 1418 + disable-secure-erase = true + use-ipxe = true + enabled-network-interfaces = "flat, noop" + } + + ironic-config = merge( + local.base-ironic-config, + var.ironic-config-overrides + ) +} + +# Dependency Apps + +variable ironic-api_app { + type = string + default = "ironic-api" +} + +variable keystone_app { + type = string + default = "keystone" +} + +variable glance_app { + type = string + default = "glance" +} + +variable rabbitmq-server_app { + type = string + default = "rabbitmq-server" +} + +variable neutron_app { + type = string + default = "neutron" +} + +variable memcache_app { + type = string + default = "memcached" +} diff --git a/juju/home-maas-jammy/modules/nova-compute/main.tf b/juju/home-maas-jammy/modules/nova-compute/main.tf index 6de534b..f9cf220 100644 --- a/juju/home-maas-jammy/modules/nova-compute/main.tf +++ b/juju/home-maas-jammy/modules/nova-compute/main.tf @@ -159,3 +159,18 @@ resource "juju_integration" "nova-compute-cinder-ceph" { endpoint = "ceph-access" } } + +resource "juju_integration" "nova-compute-nova-cloud-controller" { + + model = var.model-name + + application { + name = juju_application.nova-compute.name + endpoint = "cloud-compute" + } + + application { + name = var.nova_app + endpoint = "cloud-compute" + } +} diff --git a/juju/home-maas-jammy/modules/nova-compute/variables.tf b/juju/home-maas-jammy/modules/nova-compute/variables.tf index b851700..cb9db70 100644 --- a/juju/home-maas-jammy/modules/nova-compute/variables.tf +++ b/juju/home-maas-jammy/modules/nova-compute/variables.tf @@ -176,6 +176,11 @@ variable rabbitmq-server_app { default = "rabbitmq-server" } +variable nova_app { + type = string + default = "nova-cloud-controller" +} + # OVN variable ovn-chassis-app-name { type = string diff --git a/juju/home-maas-jammy/modules/nova/init.tf b/juju/home-maas-jammy/modules/nova/init.tf new file mode 100644 index 0000000..2efaa5b --- /dev/null +++ b/juju/home-maas-jammy/modules/nova/init.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + juju = { + version = "~> 0.19.0" + source = "registry.terraform.io/juju/juju" + } + } +} diff --git a/juju/home-maas-jammy/05-nova.tf b/juju/home-maas-jammy/modules/nova/main.tf similarity index 59% rename from juju/home-maas-jammy/05-nova.tf rename to juju/home-maas-jammy/modules/nova/main.tf index 82cc0a5..f8992c3 100644 --- a/juju/home-maas-jammy/05-nova.tf +++ b/juju/home-maas-jammy/modules/nova/main.tf @@ -1,18 +1,18 @@ 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", var.all_machines[var.controller_ids[count.index+var.num_units]].machine_id]) constraints = "spaces=oam" } resource "juju_application" "nova-cloud-controller" { - name = "nova-cloud-controller" + name = var.app-name model = var.model-name charm { name = "nova-cloud-controller" - channel = var.openstack-channel + channel = var.nova-channel base = var.default-base } @@ -40,34 +40,21 @@ resource "juju_application" "nova-cloud-controller" { space = var.internal-space }] - config = { - worker-multiplier = var.worker-multiplier - openstack-origin = var.openstack-origin - region = var.openstack-region - vip = var.vips["nova-cc"] - network-manager = "Neutron" - console-access-protocol = "novnc" - console-proxy-ip = "local" - use-internal-endpoints = "true" - ram-allocation-ratio = var.ram-allocation-ratio - cpu-allocation-ratio = var.cpu-allocation-ratio - config-flags = "scheduler_max_attempts=20" - scheduler-default-filters = var.nova-default-filters - } + config = local.nova-config } module "nova-mysql-router" { - source = "./modules/mysql-router" + source = "../mysql-router" sub-name = juju_application.nova-cloud-controller.name - model-name = juju_model.openstack.name + model-name = var.model-name } module "nova-hacluster" { - source = "./modules/hacluster" + source = "../hacluster" sub-name = juju_application.nova-cloud-controller.name - model-name = juju_model.openstack.name + model-name = var.model-name } resource "juju_integration" "nova-cloud-controller-rmq" { @@ -80,7 +67,7 @@ resource "juju_integration" "nova-cloud-controller-rmq" { } application { - name = module.rabbitmq-server.rabbitmq-server.name + name = var.rabbitmq-server_app endpoint = "amqp" } } @@ -95,7 +82,7 @@ resource "juju_integration" "nova-cloud-controller-keystone" { } application { - name = module.keystone.keystone.name + name = var.keystone_app endpoint = "identity-service" } } @@ -110,25 +97,11 @@ resource "juju_integration" "nova-cloud-controller-neutron" { } application { - name = juju_application.neutron-api.name + name = var.neutron_app endpoint = "neutron-api" } } -resource "juju_integration" "nova-cloud-controller-nova-compute" { - - model = var.model-name - - application { - name = juju_application.nova-cloud-controller.name - endpoint = "cloud-compute" - } - - application { - name = module.nova-compute-kvm.nova-compute.name - endpoint = "cloud-compute" - } -} resource "juju_integration" "nova-cloud-controller-glance" { model = var.model-name @@ -139,7 +112,7 @@ resource "juju_integration" "nova-cloud-controller-glance" { } application { - name = module.glance.glance.name + name = var.glance_app endpoint = "image-service" } } @@ -154,7 +127,7 @@ resource "juju_integration" "nova-cloud-controller-memcached" { } application { - name = module.memcached.memcached.name + name = var.memcache_app endpoint = "cache" } } diff --git a/juju/home-maas-jammy/modules/nova/outputs.tf b/juju/home-maas-jammy/modules/nova/outputs.tf new file mode 100644 index 0000000..40ded3a --- /dev/null +++ b/juju/home-maas-jammy/modules/nova/outputs.tf @@ -0,0 +1,3 @@ +output "nova" { + value = juju_application.nova-cloud-controller +} diff --git a/juju/home-maas-jammy/modules/nova/variables.tf b/juju/home-maas-jammy/modules/nova/variables.tf new file mode 100644 index 0000000..919c2a9 --- /dev/null +++ b/juju/home-maas-jammy/modules/nova/variables.tf @@ -0,0 +1,176 @@ +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 nova-channel { + type = string + default = "yoga/stable" +} + +variable nova-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 = "nova-cloud-controller" +} + +variable vips { + type = map(string) + default = {} +} + +variable cpu-allocation-ratio { + type = string + default = "16.0" +} + +variable ram-allocation-ratio { + type = string + default = "2.0" +} + +variable nova-default-filters { + type = string + default = "" +} + +variable nova-config-overrides { + type = map(string) + default = {} +} + +locals { + base-nova-config = { + worker-multiplier = var.worker-multiplier + openstack-origin = var.openstack-origin + region = var.openstack-region + vip = var.vips["nova-cc"] + network-manager = "Neutron" + console-access-protocol = "novnc" + console-proxy-ip = "local" + use-internal-endpoints = "true" + ram-allocation-ratio = var.ram-allocation-ratio + cpu-allocation-ratio = var.cpu-allocation-ratio + config-flags = "scheduler_max_attempts=20" + scheduler-default-filters = var.nova-default-filters + } + + nova-config = merge( + local.base-nova-config, + var.nova-config-overrides + ) +} + +# Dependency Apps + +variable keystone_app { + type = string + default = "keystone" +} + +variable glance_app { + type = string + default = "glance" +} + +variable rabbitmq-server_app { + type = string + default = "rabbitmq-server" +} + +variable neutron_app { + type = string + default = "neutron" +} + +variable memcache_app { + type = string + default = "memcached" +} diff --git a/juju/home-maas-jammy/modules/rabbitmq-server/variables.tf b/juju/home-maas-jammy/modules/rabbitmq-server/variables.tf index bcdac5d..e4552c7 100644 --- a/juju/home-maas-jammy/modules/rabbitmq-server/variables.tf +++ b/juju/home-maas-jammy/modules/rabbitmq-server/variables.tf @@ -26,6 +26,11 @@ variable model-name { default = "openstack" } +variable model-uuid { + type = string + default = "" +} + variable default-base { type = string default = "ubuntu@22.04" diff --git a/juju/home-maas-jammy/terraform.tfvars b/juju/home-maas-jammy/terraform.tfvars index e23b490..3efb326 100644 --- a/juju/home-maas-jammy/terraform.tfvars +++ b/juju/home-maas-jammy/terraform.tfvars @@ -1,6 +1,17 @@ -cloud = "home" +cloud = "home-maas" model-name = "cpe-jammy" +# Grab details from https://docs.openstack.org/charm-guide/latest/project/charm-delivery.html +# jammy yoga +#openstack-channel = "yoga/stable" +#ovn-channel = "22.03/stable" +#ceph-channel = "quincy/stable" + +# jammy caracal +openstack-channel = "2024.1/stable" +ovn-channel = "24.03/stable" +ceph-channel = "squid/stable" + machines = [ {machine_id=100,constraints="tags=control,asrock01"}, {machine_id=101,constraints="tags=control,asrock02"}, @@ -43,6 +54,12 @@ cinder-lvm-machines = [ {machine_id=502,constraints="tags=compute,asrock04",base="ubuntu@22.04"}, ] +landscape-machines = [ + {machine_id=600,constraints="tags=compute,asrock02",base="ubuntu@22.04"}, + {machine_id=601,constraints="tags=compute,asrock03",base="ubuntu@22.04"}, + {machine_id=602,constraints="tags=compute,asrock04",base="ubuntu@22.04"}, +] + controller_ids = [ 100, 101, 102, 103, 104, 105 ] sdn_ids = [ 400, 401, 402] k8s_ids = [ 300, 301, 302] @@ -100,7 +117,8 @@ vips = { placement = "10.0.1.223" radosgw = "10.0.1.224" designate = "10.0.1.225" - designate-bind = "10.0.1.225" + designate-bind = "10.0.1.217" + ironic-api = "10.0.1.226" } fqdn-pub = { @@ -116,6 +134,8 @@ fqdn-pub = { vault = "vault" placement = "placement" radosgw = "swift" + designate = "designate" + ironic-api = "ironic" } fqdn-int = { aodh = "aodh-int" @@ -130,6 +150,8 @@ fqdn-int = { vault = "vault-int" placement = "placement-int" radosgw = "swift-int" + designate = "designate-int" + ironic-api = "ironic-int" } fqdn-admin = { @@ -145,5 +167,7 @@ fqdn-admin = { vault = "vault-int" placement = "placement-int" radosgw = "swift-int" + designate = "designate-int" + ironic-api = "ironic-int" }