diff --git a/juju/home-maas-jammy/00-variables.tf b/juju/home-maas-jammy/00-variables.tf index 244a9d8..78a67c6 100644 --- a/juju/home-maas-jammy/00-variables.tf +++ b/juju/home-maas-jammy/00-variables.tf @@ -36,19 +36,19 @@ variable "all_services" { default = [ "easyrsa", "etcd", - "ceilometer", +# "ceilometer", "ceph-mon", # "ceph-osd", "ceph-radosgw", "cinder", "glance", - "gnocchi", +# "gnocchi", "heat", "keystone", "memcached", "mysql-innodb-cluster", "neutron-api", - "neutron-gateway", +# "neutron-gateway", "nova-compute-kvm", "nova-cloud-controller", "openstack-dashboard", @@ -63,6 +63,15 @@ variable "machines" { type = list(object({ machine_id = number constraints = string + base = optional(string) + })) +} + +variable "lma-machines" { + type = list(object({ + machine_id = number + constraints = string + base = optional(string) })) } @@ -71,6 +80,11 @@ variable model-name { default = "openstack" } +variable lma-model-name { + type = string + default = "lma" +} + variable openstack-origin { type = string default = "distro" @@ -177,13 +191,13 @@ variable customize-failure-domain { } variable reserved-host-memory { - type = number - default = 512 + type = string + default = "512" } variable worker-multiplier { - type = number - default = 0.25 + type = string + default = "0.25" } variable bridge-mappings { @@ -207,8 +221,8 @@ variable nagios-context { } variable mysql-connections { - type = number - default = 4000 + type = string + default = "4000" } variable mysql-tuning-level { @@ -282,13 +296,13 @@ variable external-network-gateway { } variable cpu-allocation-ratio { - type = number - default = 16.0 + type = string + default = "16.0" } variable ram-allocation-ratio { - type = number - default = 2.0 + type = string + default = "2.0" } variable ntp-source { @@ -302,11 +316,11 @@ variable external-network-cidr { } variable expected-osd-count { - type = number - default = 0 + type = string + default = "0" } variable expected-mon-count { - type = number - default = 3 + type = string + default = "3" } diff --git a/juju/home-maas-jammy/additional/09-filebeat.tf b/juju/home-maas-jammy/additional/09-filebeat.tf new file mode 100644 index 0000000..a2e0de6 --- /dev/null +++ b/juju/home-maas-jammy/additional/09-filebeat.tf @@ -0,0 +1,84 @@ +resource "juju_application" "filebeat" { + name = "filebeat" + + model = var.model-name + + charm { + name = "filebeat" + channel = "latest/stable" + } + + units = 0 + + endpoint_bindings = [{ + space = var.oam-space + }] + + config = { + logpath = "/var/log/*.log /var/log/*/*.log /var/log/syslog" + install_sources = <<-EOF + - 'deb http://192.168.1.12/artifacts.elastic.co/packages/6.x/apt stable main' + EOF + install_keys = <<-EOF + - | + -----BEGIN PGP PUBLIC KEY BLOCK----- + Version: SKS 1.1.6 + Comment: Hostname: keyserver.ubuntu.com + mQENBFI3HsoBCADXDtbNJnxbPqB1vDNtCsqhe49vFYsZN9IOZsZXgp7aHjh6CJBDA+bGFOwy + hbd7at35jQjWAw1O3cfYsKAmFy+Ar3LHCMkV3oZspJACTIgCrwnkic/9CUliQe324qvObU2Q + RtP4Fl0zWcfb/S8UYzWXWIFuJqMvE9MaRY1bwUBvzoqavLGZj3SF1SPO+TB5QrHkrQHBsmX+ + Jda6d4Ylt8/t6CvMwgQNlrlzIO9WT+YN6zS+sqHd1YK/aY5qhoLNhp9G/HxhcSVCkLq8SStj + 1ZZ1S9juBPoXV1ZWNbxFNGwOh/NYGldD2kmBf3YgCqeLzHahsAEpvAm8TBa7Q9W21C8vABEB + AAG0RUVsYXN0aWNzZWFyY2ggKEVsYXN0aWNzZWFyY2ggU2lnbmluZyBLZXkpIDxkZXZfb3Bz + QGVsYXN0aWNzZWFyY2gub3JnPokBOAQTAQIAIgUCUjceygIbAwYLCQgHAwIGFQgCCQoLBBYC + AwECHgECF4AACgkQ0n1mbNiOQrRzjAgAlTUQ1mgo3nK6BGXbj4XAJvuZDG0HILiUt+pPnz75 + nsf0NWhqR4yGFlmpuctgCmTD+HzYtV9fp9qW/bwVuJCNtKXk3sdzYABY+Yl0Cez/7C2GuGCO + lbn0luCNT9BxJnh4mC9h/cKI3y5jvZ7wavwe41teqG14V+EoFSn3NPKmTxcDTFrV7SmVPxCB + cQze00cJhprKxkuZMPPVqpBS+JfDQtzUQD/LSFfhHj9eD+Xe8d7sw+XvxB2aN4gnTlRzjL1n + TRp0h2/IOGkqYfIG9rWmSLNlxhB2t+c0RsjdGM4/eRlPWylFbVMc5pmDpItrkWSnzBfkmXL3 + vO2X3WvwmSFiQbkBDQRSNx7KAQgA5JUlzcMW5/cuyZR8alSacKqhSbvoSqqbzHKcUQZmlzNM + KGTABFG1yRx9r+wa/fvqP6OTRzRDvVS/cycws8YX7Ddum7x8uI95b9ye1/Xy5noPEm8cD+hp + lnpU+PBQZJ5XJ2I+1l9Nixx47wPGXeClLqcdn0ayd+v+Rwf3/XUJrvccG2YZUiQ4jWZkoxsA + 07xx7Bj+Lt8/FKG7sHRFvePFU0ZS6JFx9GJqjSBbHRRkam+4emW3uWgVfZxuwcUCn1ayNgRt + KiFv9jQrg2TIWEvzYx9tywTCxc+FFMWAlbCzi+m4WD+QUWWfDQ009U/WM0ks0KwwEwSk/UDu + ToxGnKU2dQARAQABiQEfBBgBAgAJBQJSNx7KAhsMAAoJENJ9ZmzYjkK0c3MIAIE9hAR20mqJ + WLcsxLtrRs6uNF1VrpB+4n/55QU7oxA1iVBO6IFu4qgsF12JTavnJ5MLaETlggXY+zDef9sy + TPXoQctpzcaNVDmedwo1SiL03uMoblOvWpMR/Y0j6rm7IgrMWUDXDPvoPGjMl2q1iTeyHkMZ + EyUJ8SKsaHh4jV9wp9KmC8C+9CwMukL7vM5w8cgvJoAwsp3Fn59AxWthN3XJYcnMfStkIuWg + R7U2r+a210W6vnUxU4oN0PmMcursYPyeV0NX/KQeUeNMwGTFB6QHS/anRaGQewijkrYYoTNt + fllxIu9XYmiBERQ/qPDlGRlOgVTd9xUfHFkzB52c70E= + =92oX + -----END PGP PUBLIC KEY BLOCK----- + EOF + } +} + +resource "juju_integration" "filebeat-integration" { + for_each = toset(var.all_services) + + model = var.model-name + + application { + name = juju_application.filebeat.name + endpoint = "beats-host" + } + + application { + name = "${each.value}" + endpoint = "juju-info" + } +} + +resource "juju_integration" "filebeat-graylog" { + + model = var.model-name + + application { + name = juju_application.filebeat.name + endpoint = "logstash" + } + + application { + offer_url = juju_offer.graylog.url + } +} diff --git a/juju/home-maas-jammy/additional/09-telegraf.tf b/juju/home-maas-jammy/additional/09-telegraf.tf new file mode 100644 index 0000000..629f208 --- /dev/null +++ b/juju/home-maas-jammy/additional/09-telegraf.tf @@ -0,0 +1,111 @@ +resource "juju_application" "telegraf" { + name = "telegraf" + + model = var.model-name + + charm { + name = "telegraf" + channel = "latest/stable" + revision = 65 + } + + units = 0 + + endpoint_bindings = [{ + space = var.oam-space + },{ + endpoint = "prometheus-client" + space = var.oam-space + }] + + config = { + socket_listener_port = "8095" + install_sources = <<-EOF + - 'deb http://192.168.1.12/ppa.launchpad.net/telegraf-devs/ppa/ubuntu jammy main' + EOF + install_keys = <<-EOF + - | + -----BEGIN PGP PUBLIC KEY BLOCK----- + Version: SKS 1.1.6 + Comment: Hostname: keyserver.ubuntu.com + mQINBFcVSuIBEAC80aj0tAQ6+NhGV/bkSwu6Oj+BpDR50Be3uBv7ttdtvChL5zHTnaxjdK3h + LKSyrDLlmSOkffQ2uO7CxvqeF09MsHhyvrDDx0EY54//xxoAB++PoB2OQqmqldg3Al5Hp4Dz + rllV5CIX5PD8NGX8UpO3HXk5wEwn9G81l8cia3vPveU82EIkHMiJGpk6+L86OMlwXzxkSI3M + xXgNFKQc+ELDYLvGSseYC9vPN3kdmFoo/UjznPPE4fxr4bXit3N8Abl1jYjBa0x6SWkK1BAb + s8w3BXtvyk90z9Oyme69wPD4zAYfFp+kN2nDmTDBMtNCyMu9oatdI5SukMNK4Lcm8eAE6VNs + 04j7BKvGk9+17M8WP9Pw8nIisOwScS9gUlJlLUpnBaJ+sxoOvGQ4mzZxYMKzJh0E58aEX3bS + AyzQfsae8bZLNOTcgotyzzIDJFF9npzu3wmKjeOt/706p4LiDqKUbQK6cI+QcJ/y80ZUK8pB + M043ttSHWLmTBFX2drp6zQGae9+02fX89ZD+5c+MPlubJMYCCKkvQT4OssHfC+dVDQ66rwUy + OObrzsVgikdpIxQVitL3J+Dms56xAkdFfoo+qdxxdv9S/eakc5mfavc/4WVvmFDaJiqJnJRR + Ryw1zApRtuweEEdVn8niy1mahoKpWaw1pTI4AazjWI6xJH1JyQARAQABtB9MYXVuY2hwYWQg + UFBBIGZvciBUZWxlZ3JhZiBEZXZziQI4BBMBAgAiBQJXFUriAhsDBgsJCAcDAgYVCAIJCgsE + FgIDAQIeAQIXgAAKCRDxDL4ByUQG9UgbEACa4IzdeYxH/S5I6MrZfvWNo/JTZ/MZWDD+QlMW + 60ThAemCUSE+NJvZZ1q7ovGFpYnHJT9GQXOwJAX1quDUqyM1uXNmLlOyIVNnmjUTINoLhw2V + iC8E7dMWC9w4Na2fKezmNHH00kNl43ncstIjjZ3pLnDGYm1y0ItiCUcTRgHhx2cUZ/vStz1S + Pdqj4P3i8vuspoYJ2T3VPlM/0G+u9Yjuy3Uzu9RugOyO3UJPoi3+4O2VTNosSBy5MILVCp49 + eigyFVGpq5sT/c86qd1zqmsNWEubrlzDfETS4LMj9epr46ZKPXGQkeryt1m2Oe0HkIdNZ+IQ + 5p+i9fnEy7/1uKTXWQYsg2UWsLA2PvTvwY8JxxMhUFgv12q2w7STntqJyi9PLItYNtbtKoS3 + XZCCMqQLCWMXHY+2ol6rRSfs06H/wzlR8LjDaEXkDVuDmqMtcbgTboZYblsGxst7I/Y4Wgfi + J52uiIyobQ69uJbG0XeRTLZ3WyrBkopEsTX/+sQjVqbADXYU4hBVDgnCf2uN/5dcwSEvDj8/ + +WsToAfEJkscRBsQjTLVzf+eFqHLrbqz/yoYIqBc//IJMBSbxIf5mrOHHLdbOuMCB6PVwpTI + vLFOSDNPuVDX+S1goA8KJTnXpm8jWDynn3XaXx3AlYw4iZ0ETSgQLQLRd6JuPOEGXsGdBA== + =ufaX + -----END PGP PUBLIC KEY BLOCK----- + EOF + extra_plugins = <<-EOF + [[inputs.exec]] + commands = [ "/usr/bin/awk '{print int($1)}' /proc/uptime" ] + name_override = "exec_uptime" + data_format = "value" + EOF + } +} + + +locals { + physical_apps = ["ceph-osd", "controller-server"] +} + +resource "juju_integration" "telegraf-integration" { + for_each = toset(local.physical_apps) + + model = var.model-name + + application { + name = juju_application.telegraf.name + endpoint = "juju-info" + } + + application { + name = "${each.value}" + endpoint = "juju-info" + } +} + +resource "juju_integration" "telegraf-grafana" { + + model = var.model-name + + application { + name = juju_application.telegraf.name + endpoint = "dashboards" + } + + application { + offer_url = juju_offer.grafana.url + } +} + +resource "juju_integration" "telegraf-prometheus" { + + model = var.model-name + + application { + name = juju_application.telegraf.name + endpoint = "prometheus-client" + } + + application { + offer_url = juju_offer.prometheus.url + } +} diff --git a/juju/home-maas-jammy/cos/00-init.tf b/juju/home-maas-jammy/cos/00-init.tf new file mode 120000 index 0000000..cd1a1d4 --- /dev/null +++ b/juju/home-maas-jammy/cos/00-init.tf @@ -0,0 +1 @@ +../../init.tf \ No newline at end of file diff --git a/juju/home-maas-jammy/cos/00-variables.tf b/juju/home-maas-jammy/cos/00-variables.tf new file mode 100644 index 0000000..799630b --- /dev/null +++ b/juju/home-maas-jammy/cos/00-variables.tf @@ -0,0 +1,37 @@ +variable cloud { + type = string + default = "home-maas" +} + +variable "mk8s-machines" { + type = list(object({ + machine_id = number + constraints = string + })) +} + +variable mk8s-model-name { + type = string + default = "microk8s" +} + +variable default-base { + type = string + default = "ubuntu@22.04" +} + +variable oam-space { + type = string + default = "oam" +} + +variable apt_mirror { + type = string + default = "192.168.1.12" +} + +variable lxd-snap-channel { + type = string + default = "5.21/stable" +} + diff --git a/juju/home-maas-jammy/cos/20-microk8s.tf b/juju/home-maas-jammy/cos/20-microk8s.tf new file mode 100644 index 0000000..4ecc41a --- /dev/null +++ b/juju/home-maas-jammy/cos/20-microk8s.tf @@ -0,0 +1,139 @@ +resource "juju_model" "microk8s" { + name = var.mk8s-model-name + + cloud { + name = var.cloud + } + + config = { + apt-mirror = "http://${var.apt_mirror}/archive.ubuntu.com/ubuntu" + lxd-snap-channel = var.lxd-snap-channel + + container-image-metadata-url = "http://${var.apt_mirror}/lxd/" + container-image-stream = "released" + + agent-metadata-url = "http://${var.apt_mirror}/juju/tools/" + agent-stream = "released" + } +} + + +resource "juju_machine" "mk8s" { + for_each = { + for index, machine in var.mk8s-machines: + machine.machine_id => machine + } + model = juju_model.microk8s.name + name = each.value.machine_id + constraints = each.value.constraints + #base = each.value.base +} + +resource "juju_application" "microk8s" { + name = "microk8s" + + model = juju_model.microk8s.name + + charm { + name = "microk8s" + channel = "1.28/stable" + base = var.default-base + } + + units = 4 + + placement = "${join(",", sort([ + for res in juju_machine.mk8s : + res.machine_id + ]))}" + + config = { + hostpath_storage = "true" + } +} + +resource "juju_application" "microceph" { + name = "microceph" + + model = juju_model.microk8s.name + + endpoint_bindings = [{ + "space" = var.oam-space + }] + + charm { + name = "microceph" + channel = "latest/edge" + base = var.default-base + } + + units = 4 + + placement = "${join(",", sort([ + for res in juju_machine.mk8s : + res.machine_id + ]))}" + + config = { + snap-channel = "latest/stable" + } +} + +resource "juju_machine" "cos-proxy" { + model = juju_model.microk8s.name + placement = "${join(":",["lxd", tolist(sort([ + for res in juju_machine.mk8s : + res.machine_id + ]))[0]])}" + constraints = "spaces=oam" +} + +resource "juju_application" "cos-proxy" { + name = "cos-proxy" + + model = juju_model.microk8s.name + + charm { + name = "cos-proxy" + channel = "latest/edge" + base = var.default-base + } + + units = 1 + + placement = juju_machine.cos-proxy.machine_id +} + +resource "juju_application" "ntp" { + name = "ntp" + + model = juju_model.microk8s.name + + charm { + name = "ntp" + channel = "latest/stable" + base = var.default-base + } + + units = 0 + + config = { + pools = "ntp.canonical.com" + verify_ntp_servers = "true" + } +} + +resource "juju_integration" "ntp-k8s" { + + model = juju_model.microk8s.name + + application { + name = juju_application.microk8s.name + endpoint = "juju-info" + } + + application { + name = juju_application.ntp.name + endpoint = "juju-info" + } +} diff --git a/juju/home-maas-jammy/cos/terraform.tfvars b/juju/home-maas-jammy/cos/terraform.tfvars new file mode 100644 index 0000000..4f4a1ca --- /dev/null +++ b/juju/home-maas-jammy/cos/terraform.tfvars @@ -0,0 +1,8 @@ +mk8s-machines = [ + {machine_id=2000,constraints="tags=compute,asrock01"}, + {machine_id=2001,constraints="tags=compute,asrock02"}, + {machine_id=2002,constraints="tags=compute,asrock03"}, + {machine_id=2003,constraints="tags=compute,asrock04"}, +] + +mk8s-model-name = "microk8s" diff --git a/juju/home-maas-jammy/lma/20-model.tf b/juju/home-maas-jammy/lma/20-model.tf new file mode 100644 index 0000000..8f71cdd --- /dev/null +++ b/juju/home-maas-jammy/lma/20-model.tf @@ -0,0 +1,18 @@ +resource "juju_model" "lma" { + name = var.lma-model-name + + cloud { + name = var.cloud + } + + config = { + apt-mirror = "http://${var.apt_mirror}/archive.ubuntu.com/ubuntu" + lxd-snap-channel = var.lxd-snap-channel + + container-image-metadata-url = "http://${var.apt_mirror}/lxd/" + container-image-stream = "released" + + agent-metadata-url = "http://${var.apt_mirror}/juju/tools/" + agent-stream = "released" + } +} diff --git a/juju/home-maas-jammy/lma/21-machines.tf b/juju/home-maas-jammy/lma/21-machines.tf new file mode 100644 index 0000000..ddc308f --- /dev/null +++ b/juju/home-maas-jammy/lma/21-machines.tf @@ -0,0 +1,10 @@ +resource "juju_machine" "lma_machines" { + for_each = { + for index, machine in var.lma-machines: + machine.machine_id => machine + } + model = var.lma-model-name + name = each.value.machine_id + constraints = each.value.constraints + base = each.value.base +} diff --git a/juju/home-maas-jammy/lma/22-graylog.tf b/juju/home-maas-jammy/lma/22-graylog.tf new file mode 100644 index 0000000..c478994 --- /dev/null +++ b/juju/home-maas-jammy/lma/22-graylog.tf @@ -0,0 +1,79 @@ +resource "juju_application" "graylog" { + name = "graylog" + + model = var.lma-model-name + + charm { + name = "graylog" + channel = "latest/stable" + base = "ubuntu@20.04" + } + + units = 1 + + placement = juju_machine.lma_machines["200"].machine_id + + endpoint_bindings = [{ + space = var.oam-space + }] + + config = { + channel = "4/stable" + jvm_heap_size = "1G" + rest_transport_uri = "http://graylog.example.com:9001" + index_rotation_period = "PT3H" + } +} + +resource "juju_machine" "graylog-mongodb" { + model = var.lma-model-name + placement = join(":", ["lxd", juju_machine.lma_machines["200"].machine_id]) + constraints = "spaces=oam" + base = "ubuntu@20.04" +} + + +resource "juju_application" "graylog-mongodb" { + name = "graylog-mongodb" + + model = var.lma-model-name + + charm { + name = "mongodb" + channel = "3.6/stable" + base = "ubuntu@20.04" + } + + units = 1 + + placement = juju_machine.graylog-mongodb.machine_id + + endpoint_bindings = [{ + space = var.oam-space + }] + + config = { + nagios_context = var.nagios-context + } +} + +resource "juju_integration" "graylog-mongodb" { + + model = var.lma-model-name + + application { + name = juju_application.graylog.name + endpoint = "mongodb" + } + + application { + name = juju_application.graylog-mongodb.name + endpoint = "database" + } +} + +resource "juju_offer" "graylog" { + model = var.lma-model-name + application_name = juju_application.graylog.name + endpoint = "beats" +} diff --git a/juju/home-maas-jammy/lma/23-elastic.tf b/juju/home-maas-jammy/lma/23-elastic.tf new file mode 100644 index 0000000..b5eacb0 --- /dev/null +++ b/juju/home-maas-jammy/lma/23-elastic.tf @@ -0,0 +1,74 @@ +resource "juju_application" "elasticsearch" { + name = "elasticsearch" + + model = var.lma-model-name + + charm { + name = "elasticsearch" + channel = "latest/stable" + base = "ubuntu@20.04" + } + + units = 2 + + placement = "${join(",", sort([ + for index in ["201","202"] : + juju_machine.lma_machines[index].machine_id + ]))}" + + + endpoint_bindings = [{ + space = var.oam-space + }] + + config = { + firewall_enabled = false + gpg-key = <<-EOF + -----BEGIN PGP PUBLIC KEY BLOCK----- + Version: SKS 1.1.6 + Comment: Hostname: keyserver.ubuntu.com + + mQENBFI3HsoBCADXDtbNJnxbPqB1vDNtCsqhe49vFYsZN9IOZsZXgp7aHjh6CJBDA+bGFOwy + hbd7at35jQjWAw1O3cfYsKAmFy+Ar3LHCMkV3oZspJACTIgCrwnkic/9CUliQe324qvObU2Q + RtP4Fl0zWcfb/S8UYzWXWIFuJqMvE9MaRY1bwUBvzoqavLGZj3SF1SPO+TB5QrHkrQHBsmX+ + Jda6d4Ylt8/t6CvMwgQNlrlzIO9WT+YN6zS+sqHd1YK/aY5qhoLNhp9G/HxhcSVCkLq8SStj + 1ZZ1S9juBPoXV1ZWNbxFNGwOh/NYGldD2kmBf3YgCqeLzHahsAEpvAm8TBa7Q9W21C8vABEB + AAG0RUVsYXN0aWNzZWFyY2ggKEVsYXN0aWNzZWFyY2ggU2lnbmluZyBLZXkpIDxkZXZfb3Bz + QGVsYXN0aWNzZWFyY2gub3JnPokBOAQTAQIAIgUCUjceygIbAwYLCQgHAwIGFQgCCQoLBBYC + AwECHgECF4AACgkQ0n1mbNiOQrRzjAgAlTUQ1mgo3nK6BGXbj4XAJvuZDG0HILiUt+pPnz75 + nsf0NWhqR4yGFlmpuctgCmTD+HzYtV9fp9qW/bwVuJCNtKXk3sdzYABY+Yl0Cez/7C2GuGCO + lbn0luCNT9BxJnh4mC9h/cKI3y5jvZ7wavwe41teqG14V+EoFSn3NPKmTxcDTFrV7SmVPxCB + cQze00cJhprKxkuZMPPVqpBS+JfDQtzUQD/LSFfhHj9eD+Xe8d7sw+XvxB2aN4gnTlRzjL1n + TRp0h2/IOGkqYfIG9rWmSLNlxhB2t+c0RsjdGM4/eRlPWylFbVMc5pmDpItrkWSnzBfkmXL3 + vO2X3WvwmSFiQbkBDQRSNx7KAQgA5JUlzcMW5/cuyZR8alSacKqhSbvoSqqbzHKcUQZmlzNM + KGTABFG1yRx9r+wa/fvqP6OTRzRDvVS/cycws8YX7Ddum7x8uI95b9ye1/Xy5noPEm8cD+hp + lnpU+PBQZJ5XJ2I+1l9Nixx47wPGXeClLqcdn0ayd+v+Rwf3/XUJrvccG2YZUiQ4jWZkoxsA + 07xx7Bj+Lt8/FKG7sHRFvePFU0ZS6JFx9GJqjSBbHRRkam+4emW3uWgVfZxuwcUCn1ayNgRt + KiFv9jQrg2TIWEvzYx9tywTCxc+FFMWAlbCzi+m4WD+QUWWfDQ009U/WM0ks0KwwEwSk/UDu + ToxGnKU2dQARAQABiQEfBBgBAgAJBQJSNx7KAhsMAAoJENJ9ZmzYjkK0c3MIAIE9hAR20mqJ + WLcsxLtrRs6uNF1VrpB+4n/55QU7oxA1iVBO6IFu4qgsF12JTavnJ5MLaETlggXY+zDef9sy + TPXoQctpzcaNVDmedwo1SiL03uMoblOvWpMR/Y0j6rm7IgrMWUDXDPvoPGjMl2q1iTeyHkMZ + EyUJ8SKsaHh4jV9wp9KmC8C+9CwMukL7vM5w8cgvJoAwsp3Fn59AxWthN3XJYcnMfStkIuWg + R7U2r+a210W6vnUxU4oN0PmMcursYPyeV0NX/KQeUeNMwGTFB6QHS/anRaGQewijkrYYoTNt + fllxIu9XYmiBERQ/qPDlGRlOgVTd9xUfHFkzB52c70E= + =92oX + -----END PGP PUBLIC KEY BLOCK----- + EOF + apt-repository = "deb http://192.168.1.12/artifacts.elastic.co/packages/6.x/apt stable main" + } +} + +resource "juju_integration" "graylog-elastic" { + + model = var.lma-model-name + + application { + name = juju_application.graylog.name + endpoint = "elasticsearch" + } + + application { + name = juju_application.elasticsearch.name + endpoint = "client" + } +} diff --git a/juju/home-maas-jammy/lma/24-grafana.tf b/juju/home-maas-jammy/lma/24-grafana.tf new file mode 100644 index 0000000..ff1a77f --- /dev/null +++ b/juju/home-maas-jammy/lma/24-grafana.tf @@ -0,0 +1,37 @@ +resource "juju_machine" "grafana" { + model = var.lma-model-name + placement = join(":", ["lxd", juju_machine.lma_machines["201"].machine_id]) + constraints = "spaces=oam" + base = "ubuntu@20.04" +} + +resource "juju_application" "grafana" { + name = "grafana" + + model = var.lma-model-name + + charm { + name = "grafana" + channel = "latest/stable" + base = "ubuntu@20.04" + } + + units = 1 + + placement = juju_machine.grafana.machine_id + + endpoint_bindings = [{ + space = var.oam-space + }] + + config = { + port = "3000" + install_method = "snap" + } +} + +resource "juju_offer" "grafana" { + model = var.lma-model-name + application_name = juju_application.grafana.name + endpoint = "dashboards" +} diff --git a/juju/home-maas-jammy/lma/25-prometheus.tf b/juju/home-maas-jammy/lma/25-prometheus.tf new file mode 100644 index 0000000..a9127da --- /dev/null +++ b/juju/home-maas-jammy/lma/25-prometheus.tf @@ -0,0 +1,61 @@ +resource "juju_machine" "prometheus" { + model = var.lma-model-name + placement = join(":", ["lxd", juju_machine.lma_machines["201"].machine_id]) + constraints = "spaces=oam" +} + +resource "juju_application" "prometheus" { + name = "prometheus" + + model = var.lma-model-name + + charm { + name = "prometheus2" + channel = "latest/stable" + base = var.default-base + revision = 48 + } + + units = 1 + + placement = juju_machine.prometheus.machine_id + + endpoint_bindings = [{ + space = var.oam-space + }] +} + +resource "juju_integration" "prometheus-grafana" { + model = var.lma-model-name + + application { + name = juju_application.prometheus.name + endpoint = "grafana-source" + } + + application { + name = juju_application.grafana.name + endpoint = "grafana-source" + } +} + +resource "juju_integration" "ceph-mon-prometheus" { + + model = var.model-name + + application { + name = juju_application.ceph-mon.name + endpoint = "prometheus" + } + + application { + offer_url = juju_offer.prometheus.url + } +} + +resource "juju_offer" "prometheus" { + model = var.lma-model-name + application_name = juju_application.prometheus.name + endpoint = "target" +} + diff --git a/juju/home-maas-jammy/terraform.tfvars b/juju/home-maas-jammy/terraform.tfvars index 730a4b2..58c8f4b 100644 --- a/juju/home-maas-jammy/terraform.tfvars +++ b/juju/home-maas-jammy/terraform.tfvars @@ -20,12 +20,18 @@ machines = [ {machine_id=1007,constraints="tags=compute,asrock04"}, ] +lma-machines = [ + {machine_id=200,constraints="tags=compute,asrock01",base="ubuntu@20.04"}, + {machine_id=201,constraints="tags=compute,asrock04",base="ubuntu@20.04"}, + {machine_id=202,constraints="tags=compute,asrock02",base="ubuntu@20.04"}, +] + osd-devices = "/dev/sdb /dev/sdc" nagios-context = "arif-nc01" -ram-allocation-ratio = 1.0 -cpu-allocation-ratio = 2.0 +ram-allocation-ratio = "1.0" +cpu-allocation-ratio = "2.0" oam-space = "oam" admin-space = "oam" @@ -35,8 +41,8 @@ ceph-public-space = "ceph-access" ceph-cluster-space = "ceph-replica" overlay-space = "overlay" -expected-osd-count = 12 -expected-mon-count = 3 +expected-osd-count = "12" +expected-mon-count = "3" ntp-source = "192.168.1.11" external-network-cidr = "192.168.1.0/24"