diff --git a/juju/home-maas-focal/00-init.tf b/juju/home-maas-focal/00-init.tf index e54deec..5aff294 100644 --- a/juju/home-maas-focal/00-init.tf +++ b/juju/home-maas-focal/00-init.tf @@ -1,9 +1,8 @@ terraform { required_providers { juju = { - version = "~> 0.12.0" - #source = "juju/juju" - source = "terraform.local/juju/juju" + version = "~> 0.15.0" + source = "juju/juju" } } } diff --git a/juju/home-maas-focal/00-variables.tf b/juju/home-maas-focal/00-variables.tf index bae33ea..c3481c2 100644 --- a/juju/home-maas-focal/00-variables.tf +++ b/juju/home-maas-focal/00-variables.tf @@ -36,13 +36,13 @@ variable "all_services" { default = [ "easyrsa", "etcd", - "ceilometer", +# "ceilometer", "ceph-mon", # "ceph-osd", "ceph-radosgw", "cinder", "glance", - "gnocchi", +# "gnocchi", "heat", "keystone", "memcached", @@ -75,7 +75,14 @@ variable "lma-machines" { })) } -variable model-name { +variable "infra-machines" { + type = list(object({ + machine_id = number + name = string + })) +} + +variable openstack-model-name { type = string default = "openstack" } @@ -85,6 +92,11 @@ variable lma-model-name { default = "lma" } +variable infra-model-name { + type = string + default = "infra" +} + variable openstack-origin { type = string default = "distro" @@ -167,7 +179,7 @@ variable "etcd_channel" { variable "etcd_revision" { type = string - default = "583" + default = "" } variable "easyrsa_channel" { diff --git a/juju/home-maas-focal/01-cloud.tf b/juju/home-maas-focal/01-cloud.tf index 69acb0c..38e605c 100644 --- a/juju/home-maas-focal/01-cloud.tf +++ b/juju/home-maas-focal/01-cloud.tf @@ -1,5 +1,5 @@ resource "juju_model" "openstack" { - name = var.model-name + name = var.openstack-model-name cloud { name = var.cloud diff --git a/juju/home-maas-focal/03-machines.tf b/juju/home-maas-focal/03-machines.tf index 19df533..18a21df 100644 --- a/juju/home-maas-focal/03-machines.tf +++ b/juju/home-maas-focal/03-machines.tf @@ -3,7 +3,7 @@ resource "juju_machine" "all_machines" { for index, machine in var.machines: machine.machine_id => machine } - model = var.model-name + model = juju_model.openstack.name name = each.value.machine_id constraints = each.value.constraints } diff --git a/juju/home-maas-focal/04-keystone.tf b/juju/home-maas-focal/04-keystone.tf index b0e5013..ae6834c 100644 --- a/juju/home-maas-focal/04-keystone.tf +++ b/juju/home-maas-focal/04-keystone.tf @@ -1,6 +1,6 @@ resource "juju_machine" "keystone" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index+var.num_units]].machine_id]) constraints = "spaces=oam" } @@ -8,7 +8,7 @@ resource "juju_machine" "keystone" { resource "juju_application" "keystone" { name = "keystone" - model = var.model-name + model = juju_model.openstack.name charm { name = "keystone" @@ -52,7 +52,7 @@ resource "juju_application" "keystone" { resource "juju_application" "keystone-mysql-router" { name = "keystone-mysql-router" - model = var.model-name + model = juju_model.openstack.name charm { name = "mysql-router" @@ -79,7 +79,7 @@ resource "juju_application" "keystone-mysql-router" { resource "juju_application" "hacluster-keystone" { name = "hacluster-keystone" - model = var.model-name + model = juju_model.openstack.name charm { name = "hacluster" @@ -91,7 +91,7 @@ resource "juju_application" "hacluster-keystone" { resource "juju_integration" "keystone-ha" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.keystone.name @@ -106,7 +106,7 @@ resource "juju_integration" "keystone-ha" { resource "juju_integration" "keystone-mysql" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.keystone.name @@ -121,7 +121,7 @@ resource "juju_integration" "keystone-mysql" { resource "juju_integration" "keystone-db" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.keystone-mysql-router.name diff --git a/juju/home-maas-focal/04-mysql.tf b/juju/home-maas-focal/04-mysql.tf index 277d0ff..98ed93f 100644 --- a/juju/home-maas-focal/04-mysql.tf +++ b/juju/home-maas-focal/04-mysql.tf @@ -1,6 +1,6 @@ resource "juju_machine" "mysql" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index]].machine_id]) constraints = "spaces=oam" } @@ -8,7 +8,7 @@ resource "juju_machine" "mysql" { resource "juju_application" "mysql-innodb-cluster" { name = "mysql-innodb-cluster" - model = var.model-name + model = juju_model.openstack.name charm { name = "mysql-innodb-cluster" diff --git a/juju/home-maas-focal/04-rmq.tf b/juju/home-maas-focal/04-rmq.tf index 0000097..684c6c3 100644 --- a/juju/home-maas-focal/04-rmq.tf +++ b/juju/home-maas-focal/04-rmq.tf @@ -1,6 +1,6 @@ resource "juju_machine" "rmq" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index+var.num_units]].machine_id]) constraints = "spaces=oam" } @@ -8,7 +8,7 @@ resource "juju_machine" "rmq" { resource "juju_application" "rabbitmq-server" { name = "rabbitmq-server" - model = var.model-name + model = juju_model.openstack.name charm { name = "rabbitmq-server" diff --git a/juju/home-maas-focal/05-ceph.tf b/juju/home-maas-focal/05-ceph.tf index 4cdff7e..ce237c1 100644 --- a/juju/home-maas-focal/05-ceph.tf +++ b/juju/home-maas-focal/05-ceph.tf @@ -1,7 +1,7 @@ resource "juju_application" "ceph-osd" { name = "ceph-osd" - model = var.model-name + model = juju_model.openstack.name charm { name = "ceph-osd" @@ -29,7 +29,7 @@ resource "juju_application" "ceph-osd" { resource "juju_machine" "ceph-mon" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index]].machine_id]) constraints = "spaces=oam,ceph-access,ceph-replica" } @@ -37,7 +37,7 @@ resource "juju_machine" "ceph-mon" { resource "juju_application" "ceph-mon" { name = "ceph-mon" - model = var.model-name + model = juju_model.openstack.name charm { name = "ceph-mon" @@ -80,7 +80,7 @@ resource "juju_application" "ceph-mon" { resource "juju_machine" "ceph-rgw" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index]].machine_id]) constraints = "spaces=oam,ceph-access" } @@ -88,7 +88,7 @@ resource "juju_machine" "ceph-rgw" { resource "juju_application" "ceph-radosgw" { name = "ceph-radosgw" - model = var.model-name + model = juju_model.openstack.name charm { name = "ceph-radosgw" @@ -132,7 +132,7 @@ resource "juju_application" "ceph-radosgw" { resource "juju_application" "hacluster-radosgw" { name = "hacluster-radosgw" - model = var.model-name + model = juju_model.openstack.name charm { name = "hacluster" @@ -144,7 +144,7 @@ resource "juju_application" "hacluster-radosgw" { resource "juju_integration" "osd-mon" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.ceph-osd.name @@ -159,7 +159,7 @@ resource "juju_integration" "osd-mon" { resource "juju_integration" "rgw-mon" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.ceph-radosgw.name @@ -174,7 +174,7 @@ resource "juju_integration" "rgw-mon" { resource "juju_integration" "rgw-ha" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.ceph-radosgw.name @@ -189,7 +189,7 @@ resource "juju_integration" "rgw-ha" { resource "juju_integration" "rgw-keystone" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.ceph-radosgw.name diff --git a/juju/home-maas-focal/05-cinder.tf b/juju/home-maas-focal/05-cinder.tf index 099b1c6..a01fbf9 100644 --- a/juju/home-maas-focal/05-cinder.tf +++ b/juju/home-maas-focal/05-cinder.tf @@ -1,6 +1,6 @@ resource "juju_machine" "cinder" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index]].machine_id]) constraints = "spaces=oam" } @@ -8,7 +8,7 @@ resource "juju_machine" "cinder" { resource "juju_application" "cinder" { name = "cinder" - model = var.model-name + model = juju_model.openstack.name charm { name = "cinder" @@ -53,7 +53,7 @@ resource "juju_application" "cinder" { resource "juju_application" "cinder-ceph" { name = "cinder-ceph" - model = var.model-name + model = juju_model.openstack.name charm { name = "cinder-ceph" @@ -71,7 +71,7 @@ resource "juju_application" "cinder-ceph" { resource "juju_application" "cinder-mysql-router" { name = "cinder-mysql-router" - model = var.model-name + model = juju_model.openstack.name charm { name = "mysql-router" @@ -98,7 +98,7 @@ resource "juju_application" "cinder-mysql-router" { resource "juju_application" "hacluster-cinder" { name = "hacluster-cinder" - model = var.model-name + model = juju_model.openstack.name charm { name = "hacluster" @@ -110,7 +110,7 @@ resource "juju_application" "hacluster-cinder" { resource "juju_integration" "cinder-ha" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.cinder.name @@ -125,7 +125,7 @@ resource "juju_integration" "cinder-ha" { resource "juju_integration" "cinder-mysql" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.cinder.name @@ -140,7 +140,7 @@ resource "juju_integration" "cinder-mysql" { resource "juju_integration" "cinder-db" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.cinder-mysql-router.name @@ -155,7 +155,7 @@ resource "juju_integration" "cinder-db" { resource "juju_integration" "cinder-rmq" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.cinder.name @@ -170,7 +170,7 @@ resource "juju_integration" "cinder-rmq" { resource "juju_integration" "cinder-keystone" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.cinder.name @@ -185,7 +185,7 @@ resource "juju_integration" "cinder-keystone" { resource "juju_integration" "cinder-ceph" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.cinder.name @@ -200,7 +200,7 @@ resource "juju_integration" "cinder-ceph" { resource "juju_integration" "cinder-ceph-mon" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.cinder-ceph.name @@ -215,7 +215,7 @@ resource "juju_integration" "cinder-ceph-mon" { resource "juju_integration" "cinder-ceph-cinder" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.cinder-ceph.name diff --git a/juju/home-maas-focal/05-glance.tf b/juju/home-maas-focal/05-glance.tf index de7b258..378a5f9 100644 --- a/juju/home-maas-focal/05-glance.tf +++ b/juju/home-maas-focal/05-glance.tf @@ -1,6 +1,6 @@ resource "juju_machine" "glance" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index]].machine_id]) constraints = "spaces=oam" } @@ -8,7 +8,7 @@ resource "juju_machine" "glance" { resource "juju_application" "glance" { name = "glance" - model = var.model-name + model = juju_model.openstack.name charm { name = "glance" @@ -51,7 +51,7 @@ resource "juju_application" "glance" { resource "juju_application" "glance-mysql-router" { name = "glance-mysql-router" - model = var.model-name + model = juju_model.openstack.name charm { name = "mysql-router" @@ -78,7 +78,7 @@ resource "juju_application" "glance-mysql-router" { resource "juju_application" "hacluster-glance" { name = "hacluster-glance" - model = var.model-name + model = juju_model.openstack.name charm { name = "hacluster" @@ -91,7 +91,7 @@ resource "juju_application" "hacluster-glance" { resource "juju_integration" "glance-ha" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.glance.name @@ -106,7 +106,7 @@ resource "juju_integration" "glance-ha" { resource "juju_integration" "glance-mysql" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.glance.name @@ -121,7 +121,7 @@ resource "juju_integration" "glance-mysql" { resource "juju_integration" "glance-db" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.glance-mysql-router.name @@ -136,7 +136,7 @@ resource "juju_integration" "glance-db" { resource "juju_integration" "glance-rmq" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.glance.name @@ -151,7 +151,7 @@ resource "juju_integration" "glance-rmq" { resource "juju_integration" "glance-keystone" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.glance.name @@ -166,7 +166,7 @@ resource "juju_integration" "glance-keystone" { resource "juju_integration" "glance-ceph" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.glance.name @@ -181,7 +181,7 @@ resource "juju_integration" "glance-ceph" { resource "juju_integration" "glance-cinder" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.glance.name diff --git a/juju/home-maas-focal/05-heat.tf b/juju/home-maas-focal/05-heat.tf index 2cab20a..bd409ba 100644 --- a/juju/home-maas-focal/05-heat.tf +++ b/juju/home-maas-focal/05-heat.tf @@ -1,6 +1,6 @@ resource "juju_machine" "heat" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index]].machine_id]) constraints = "spaces=oam" } @@ -8,7 +8,7 @@ resource "juju_machine" "heat" { resource "juju_application" "heat" { name = "heat" - model = var.model-name + model = juju_model.openstack.name charm { name = "heat" @@ -51,7 +51,7 @@ resource "juju_application" "heat" { resource "juju_application" "heat-mysql-router" { name = "heat-mysql-router" - model = var.model-name + model = juju_model.openstack.name charm { name = "mysql-router" @@ -78,7 +78,7 @@ resource "juju_application" "heat-mysql-router" { resource "juju_application" "hacluster-heat" { name = "hacluster-heat" - model = var.model-name + model = juju_model.openstack.name charm { name = "hacluster" @@ -90,7 +90,7 @@ resource "juju_application" "hacluster-heat" { resource "juju_integration" "heat-ha" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.heat.name @@ -105,7 +105,7 @@ resource "juju_integration" "heat-ha" { resource "juju_integration" "heat-mysql" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.heat.name @@ -120,7 +120,7 @@ resource "juju_integration" "heat-mysql" { resource "juju_integration" "heat-db" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.heat-mysql-router.name @@ -135,7 +135,7 @@ resource "juju_integration" "heat-db" { resource "juju_integration" "heat-rmq" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.heat.name @@ -150,7 +150,7 @@ resource "juju_integration" "heat-rmq" { resource "juju_integration" "heat-keystone" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.heat.name diff --git a/juju/home-maas-focal/05-memcache.tf b/juju/home-maas-focal/05-memcache.tf index b8efaab..a4dc403 100644 --- a/juju/home-maas-focal/05-memcache.tf +++ b/juju/home-maas-focal/05-memcache.tf @@ -1,6 +1,6 @@ resource "juju_machine" "memcache" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index]].machine_id]) constraints = "spaces=oam" } @@ -8,7 +8,7 @@ resource "juju_machine" "memcache" { resource "juju_application" "memcached" { name = "memcached" - model = var.model-name + model = juju_model.openstack.name charm { name = "memcached" @@ -38,7 +38,7 @@ resource "juju_application" "memcached" { resource "juju_integration" "nova-cloud-controller-memcache" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-cloud-controller.name diff --git a/juju/home-maas-focal/05-nova.tf b/juju/home-maas-focal/05-nova.tf index 0ce4a9d..8020979 100644 --- a/juju/home-maas-focal/05-nova.tf +++ b/juju/home-maas-focal/05-nova.tf @@ -1,6 +1,6 @@ resource "juju_machine" "ncc" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index+var.num_units]].machine_id]) constraints = "spaces=oam" } @@ -8,7 +8,7 @@ resource "juju_machine" "ncc" { resource "juju_application" "nova-cloud-controller" { name = "nova-cloud-controller" - model = var.model-name + model = juju_model.openstack.name charm { name = "nova-cloud-controller" @@ -59,7 +59,7 @@ resource "juju_application" "nova-cloud-controller" { resource "juju_application" "nova-cloud-controller-mysql-router" { name = "nova-cloud-controller-mysql-router" - model = var.model-name + model = juju_model.openstack.name charm { name = "mysql-router" @@ -86,7 +86,7 @@ resource "juju_application" "nova-cloud-controller-mysql-router" { resource "juju_application" "hacluster-nova" { name = "hacluster-nova" - model = var.model-name + model = juju_model.openstack.name charm { name = "hacluster" @@ -98,7 +98,7 @@ resource "juju_application" "hacluster-nova" { resource "juju_integration" "nova-cloud-controller-ha" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-cloud-controller.name @@ -113,7 +113,7 @@ resource "juju_integration" "nova-cloud-controller-ha" { resource "juju_integration" "nova-cloud-controller-mysql" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-cloud-controller.name @@ -128,7 +128,7 @@ resource "juju_integration" "nova-cloud-controller-mysql" { resource "juju_integration" "nova-cloud-controller-db" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-cloud-controller-mysql-router.name @@ -143,7 +143,7 @@ resource "juju_integration" "nova-cloud-controller-db" { resource "juju_integration" "nova-cloud-controller-rmq" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-cloud-controller.name @@ -158,7 +158,7 @@ resource "juju_integration" "nova-cloud-controller-rmq" { resource "juju_integration" "nova-cloud-controller-keystone" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-cloud-controller.name @@ -173,7 +173,7 @@ resource "juju_integration" "nova-cloud-controller-keystone" { resource "juju_integration" "nova-cloud-controller-neutron" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-cloud-controller.name @@ -188,7 +188,7 @@ resource "juju_integration" "nova-cloud-controller-neutron" { resource "juju_integration" "nova-cloud-controller-nova-compute" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-cloud-controller.name @@ -202,7 +202,7 @@ resource "juju_integration" "nova-cloud-controller-nova-compute" { } resource "juju_integration" "nova-cloud-controller-glance" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-cloud-controller.name diff --git a/juju/home-maas-focal/05-placement.tf b/juju/home-maas-focal/05-placement.tf index 6b674ea..ba55c5d 100644 --- a/juju/home-maas-focal/05-placement.tf +++ b/juju/home-maas-focal/05-placement.tf @@ -1,6 +1,6 @@ resource "juju_machine" "placement" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index+var.num_units]].machine_id]) constraints = "spaces=oam" } @@ -8,7 +8,7 @@ resource "juju_machine" "placement" { resource "juju_application" "placement" { name = "placement" - model = var.model-name + model = juju_model.openstack.name charm { name = "placement" @@ -48,7 +48,7 @@ resource "juju_application" "placement" { resource "juju_application" "placement-mysql-router" { name = "placement-mysql-router" - model = var.model-name + model = juju_model.openstack.name charm { name = "mysql-router" @@ -75,7 +75,7 @@ resource "juju_application" "placement-mysql-router" { resource "juju_application" "hacluster-placement" { name = "hacluster-placement" - model = var.model-name + model = juju_model.openstack.name charm { name = "hacluster" @@ -87,7 +87,7 @@ resource "juju_application" "hacluster-placement" { resource "juju_integration" "placement-ha" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.placement.name @@ -102,7 +102,7 @@ resource "juju_integration" "placement-ha" { resource "juju_integration" "placement-mysql" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.placement.name @@ -117,7 +117,7 @@ resource "juju_integration" "placement-mysql" { resource "juju_integration" "placement-db" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.placement-mysql-router.name @@ -132,7 +132,7 @@ resource "juju_integration" "placement-db" { resource "juju_integration" "placement-keystone" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.placement.name @@ -147,7 +147,7 @@ resource "juju_integration" "placement-keystone" { resource "juju_integration" "placement-nova" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.placement.name diff --git a/juju/home-maas-focal/06-nova-compute.tf b/juju/home-maas-focal/06-nova-compute.tf index 3977e32..aa3da43 100644 --- a/juju/home-maas-focal/06-nova-compute.tf +++ b/juju/home-maas-focal/06-nova-compute.tf @@ -1,7 +1,7 @@ resource "juju_application" "nova-compute-kvm" { name = "nova-compute-kvm" - model = var.model-name + model = juju_model.openstack.name charm { name = "nova-compute" @@ -57,7 +57,7 @@ resource "juju_application" "nova-compute-kvm" { resource "juju_application" "neutron-openvswitch" { name = "neutron-openvswitch" - model = var.model-name + model = juju_model.openstack.name charm { name = "neutron-openvswitch" @@ -85,7 +85,7 @@ resource "juju_application" "neutron-openvswitch" { resource "juju_application" "sysconfig-compute" { name = "sysconfig-compute" - model = var.model-name + model = juju_model.openstack.name charm { name = "sysconfig" @@ -106,7 +106,7 @@ resource "juju_application" "sysconfig-compute" { resource "juju_integration" "compute-ovs" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.neutron-openvswitch.name @@ -121,7 +121,7 @@ resource "juju_integration" "compute-ovs" { resource "juju_integration" "compute-sysconfig" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-compute-kvm.name @@ -136,7 +136,7 @@ resource "juju_integration" "compute-sysconfig" { resource "juju_integration" "compute-ceph-mon" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-compute-kvm.name @@ -151,7 +151,7 @@ resource "juju_integration" "compute-ceph-mon" { resource "juju_integration" "neutron-api-ovs" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.neutron-openvswitch.name @@ -166,7 +166,7 @@ resource "juju_integration" "neutron-api-ovs" { resource "juju_integration" "nova-compute-rmq" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-compute-kvm.name @@ -181,7 +181,7 @@ resource "juju_integration" "nova-compute-rmq" { resource "juju_integration" "neutron-ovs-rmq" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.neutron-openvswitch.name @@ -196,7 +196,7 @@ resource "juju_integration" "neutron-ovs-rmq" { resource "juju_integration" "nova-compute-glance" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-compute-kvm.name @@ -211,7 +211,7 @@ resource "juju_integration" "nova-compute-glance" { resource "juju_integration" "nova-compute-cinder-ceph" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-compute-kvm.name diff --git a/juju/home-maas-focal/06-openstack-dashboard.tf b/juju/home-maas-focal/06-openstack-dashboard.tf index ed3eb3c..f8d077c 100644 --- a/juju/home-maas-focal/06-openstack-dashboard.tf +++ b/juju/home-maas-focal/06-openstack-dashboard.tf @@ -1,6 +1,6 @@ resource "juju_machine" "openstack-dashboard" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index]].machine_id]) constraints = "spaces=oam,ceph-access" } @@ -8,7 +8,7 @@ resource "juju_machine" "openstack-dashboard" { resource "juju_application" "openstack-dashboard" { name = "openstack-dashboard" - model = var.model-name + model = juju_model.openstack.name charm { name = "openstack-dashboard" @@ -47,7 +47,7 @@ resource "juju_application" "openstack-dashboard" { resource "juju_application" "openstack-dashboard-mysql-router" { name = "openstack-dashboard-mysql-router" - model = var.model-name + model = juju_model.openstack.name charm { name = "mysql-router" @@ -74,7 +74,7 @@ resource "juju_application" "openstack-dashboard-mysql-router" { resource "juju_application" "hacluster-openstack-dashboard" { name = "hacluster-openstack-dashboard" - model = var.model-name + model = juju_model.openstack.name charm { name = "hacluster" @@ -86,7 +86,7 @@ resource "juju_application" "hacluster-openstack-dashboard" { resource "juju_integration" "openstack-dashboard-ha" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.openstack-dashboard.name @@ -101,7 +101,7 @@ resource "juju_integration" "openstack-dashboard-ha" { resource "juju_integration" "openstack-dashboard-mysql" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.openstack-dashboard.name @@ -116,7 +116,7 @@ resource "juju_integration" "openstack-dashboard-mysql" { resource "juju_integration" "openstack-dashboard-db" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.openstack-dashboard-mysql-router.name @@ -131,7 +131,7 @@ resource "juju_integration" "openstack-dashboard-db" { resource "juju_integration" "openstack-dashboard-keystone" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.openstack-dashboard.name diff --git a/juju/home-maas-focal/07-controllers.tf b/juju/home-maas-focal/07-controllers.tf index 3453d5f..734aa4d 100644 --- a/juju/home-maas-focal/07-controllers.tf +++ b/juju/home-maas-focal/07-controllers.tf @@ -1,7 +1,7 @@ resource "juju_application" "controller-server" { name = "controller-server" - model = var.model-name + model = juju_model.openstack.name charm { name = "ubuntu" @@ -21,7 +21,7 @@ resource "juju_application" "controller-server" { resource "juju_application" "sysconfig-control" { name = "sysconfig-control" - model = var.model-name + model = juju_model.openstack.name charm { name = "sysconfig" @@ -41,7 +41,7 @@ resource "juju_application" "sysconfig-control" { resource "juju_integration" "control-sysconfig" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.sysconfig-control.name diff --git a/juju/home-maas-focal/08-neutron.tf b/juju/home-maas-focal/08-neutron.tf index 06ba712..e73f4d1 100644 --- a/juju/home-maas-focal/08-neutron.tf +++ b/juju/home-maas-focal/08-neutron.tf @@ -1,7 +1,7 @@ resource "juju_application" "neutron-gateway" { name = "neutron-gateway" - model = var.model-name + model = juju_model.openstack.name charm { name = "neutron-gateway" @@ -29,7 +29,7 @@ resource "juju_application" "neutron-gateway" { resource "juju_machine" "neutron-api" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index]].machine_id]) constraints = "spaces=oam" } @@ -37,7 +37,7 @@ resource "juju_machine" "neutron-api" { resource "juju_application" "neutron-api" { name = "neutron-api" - model = var.model-name + model = juju_model.openstack.name charm { name = "neutron-api" @@ -92,7 +92,7 @@ resource "juju_application" "neutron-api" { resource "juju_application" "neutron-mysql-router" { name = "neutron-mysql-router" - model = var.model-name + model = juju_model.openstack.name charm { name = "mysql-router" @@ -119,7 +119,7 @@ resource "juju_application" "neutron-mysql-router" { resource "juju_application" "hacluster-neutron" { name = "hacluster-neutron" - model = var.model-name + model = juju_model.openstack.name charm { name = "hacluster" @@ -131,7 +131,7 @@ resource "juju_application" "hacluster-neutron" { resource "juju_integration" "neutron-ha" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.neutron-api.name @@ -146,7 +146,7 @@ resource "juju_integration" "neutron-ha" { resource "juju_integration" "neutron-mysql" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.neutron-api.name @@ -161,7 +161,7 @@ resource "juju_integration" "neutron-mysql" { resource "juju_integration" "neutron-db" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.neutron-mysql-router.name @@ -176,7 +176,7 @@ resource "juju_integration" "neutron-db" { resource "juju_integration" "neutron-keystone" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.neutron-api.name @@ -191,7 +191,7 @@ resource "juju_integration" "neutron-keystone" { resource "juju_integration" "neutron-api-rmq" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.neutron-api.name @@ -206,7 +206,7 @@ resource "juju_integration" "neutron-api-rmq" { resource "juju_integration" "neutron-gw-rmq" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.neutron-gateway.name diff --git a/juju/home-maas-focal/10-vault.tf b/juju/home-maas-focal/10-vault.tf index 736b086..3732ad7 100644 --- a/juju/home-maas-focal/10-vault.tf +++ b/juju/home-maas-focal/10-vault.tf @@ -1,6 +1,6 @@ resource "juju_machine" "vault" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":",["lxd",juju_machine.all_machines[var.sdn_ids[count.index]].machine_id]) constraints = "spaces=oam" } @@ -8,7 +8,7 @@ resource "juju_machine" "vault" { resource "juju_application" "vault" { name = "vault" - model = var.model-name + model = juju_model.openstack.name charm { name = "vault" @@ -33,7 +33,7 @@ resource "juju_application" "vault" { resource "juju_application" "vault-mysql-router" { name = "vault-mysql-router" - model = var.model-name + model = juju_model.openstack.name charm { name = "mysql-router" @@ -62,7 +62,7 @@ resource "juju_application" "vault-mysql-router" { resource "juju_application" "hacluster-vault" { name = "hacluster-vault" - model = var.model-name + model = juju_model.openstack.name charm { name = "hacluster" @@ -75,7 +75,7 @@ resource "juju_application" "hacluster-vault" { resource "juju_machine" "etcd" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":",["lxd",juju_machine.all_machines[var.sdn_ids[count.index]].machine_id]) constraints = "spaces=oam" } @@ -83,13 +83,13 @@ resource "juju_machine" "etcd" { resource "juju_application" "etcd" { name = "etcd" - model = var.model-name + model = juju_model.openstack.name charm { name = "etcd" channel = var.etcd_channel + #revision = var.etcd_revision base = var.default-base - revision = var.etcd_revision } placement = "${join(",",sort([ @@ -115,7 +115,7 @@ resource "juju_application" "etcd" { } resource "juju_machine" "easyrsa" { - model = var.model-name + model = juju_model.openstack.name placement = join(":",["lxd",juju_machine.all_machines["402"].machine_id]) constraints = "spaces=oam" } @@ -123,7 +123,7 @@ resource "juju_machine" "easyrsa" { resource "juju_application" "easyrsa" { name = "easyrsa" - model = var.model-name + model = juju_model.openstack.name charm { name = "easyrsa" @@ -140,7 +140,7 @@ resource "juju_application" "easyrsa" { resource "juju_integration" "vault-etcd" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.vault.name @@ -155,7 +155,7 @@ resource "juju_integration" "vault-etcd" { resource "juju_integration" "etcd-easyrsa" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.etcd.name @@ -170,7 +170,7 @@ resource "juju_integration" "etcd-easyrsa" { resource "juju_integration" "vault-ha" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.vault.name @@ -185,7 +185,7 @@ resource "juju_integration" "vault-ha" { resource "juju_integration" "vault-mysql" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.vault.name @@ -200,7 +200,7 @@ resource "juju_integration" "vault-mysql" { resource "juju_integration" "vault-ceph" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.vault.name @@ -215,7 +215,7 @@ resource "juju_integration" "vault-ceph" { resource "juju_integration" "vault-db" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.vault-mysql-router.name diff --git a/juju/home-maas-focal/additional/05-ceilometer.tf b/juju/home-maas-focal/additional/05-ceilometer.tf index 91a8347..6267cb3 100644 --- a/juju/home-maas-focal/additional/05-ceilometer.tf +++ b/juju/home-maas-focal/additional/05-ceilometer.tf @@ -1,6 +1,6 @@ resource "juju_machine" "ceilometer" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index+var.num_units]].machine_id]) constraints = "spaces=oam" } @@ -8,7 +8,7 @@ resource "juju_machine" "ceilometer" { resource "juju_application" "ceilometer" { name = "ceilometer" - model = var.model-name + model = juju_model.openstack.name charm { name = "ceilometer" @@ -44,7 +44,7 @@ resource "juju_application" "ceilometer" { resource "juju_integration" "ceilometer-rmq" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.ceilometer.name @@ -59,7 +59,7 @@ resource "juju_integration" "ceilometer-rmq" { resource "juju_integration" "ceilometer-keystone" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.ceilometer.name @@ -74,7 +74,7 @@ resource "juju_integration" "ceilometer-keystone" { resource "juju_integration" "ceilometer-ceil-agent" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.ceilometer.name diff --git a/juju/home-maas-focal/additional/05-gnocchi.tf b/juju/home-maas-focal/additional/05-gnocchi.tf index 1132378..5207435 100644 --- a/juju/home-maas-focal/additional/05-gnocchi.tf +++ b/juju/home-maas-focal/additional/05-gnocchi.tf @@ -1,6 +1,6 @@ resource "juju_machine" "gnocchi" { count = var.num_units - model = var.model-name + model = juju_model.openstack.name placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index+var.num_units]].machine_id]) constraints = "spaces=oam,ceph-access" } @@ -8,7 +8,7 @@ resource "juju_machine" "gnocchi" { resource "juju_application" "gnocchi" { name = "gnocchi" - model = var.model-name + model = juju_model.openstack.name charm { name = "gnocchi" @@ -56,7 +56,7 @@ resource "juju_application" "gnocchi" { resource "juju_application" "gnocchi-mysql-router" { name = "gnocchi-mysql-router" - model = var.model-name + model = juju_model.openstack.name charm { name = "mysql-router" @@ -83,7 +83,7 @@ resource "juju_application" "gnocchi-mysql-router" { resource "juju_application" "hacluster-gnocchi" { name = "hacluster-gnocchi" - model = var.model-name + model = juju_model.openstack.name charm { name = "hacluster" @@ -96,7 +96,7 @@ resource "juju_application" "hacluster-gnocchi" { resource "juju_integration" "gnocchi-ha" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.gnocchi.name @@ -111,7 +111,7 @@ resource "juju_integration" "gnocchi-ha" { resource "juju_integration" "gnocchi-mysql" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.gnocchi.name @@ -126,7 +126,7 @@ resource "juju_integration" "gnocchi-mysql" { resource "juju_integration" "gnocchi-db" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.gnocchi-mysql-router.name @@ -141,7 +141,7 @@ resource "juju_integration" "gnocchi-db" { resource "juju_integration" "gnocchi-rmq" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.gnocchi.name @@ -156,7 +156,7 @@ resource "juju_integration" "gnocchi-rmq" { resource "juju_integration" "gnocchi-keystone" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.gnocchi.name @@ -171,7 +171,7 @@ resource "juju_integration" "gnocchi-keystone" { resource "juju_integration" "gnocchi-ceph" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.gnocchi.name @@ -186,7 +186,7 @@ resource "juju_integration" "gnocchi-ceph" { resource "juju_integration" "gnocchi-memcache" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.gnocchi.name @@ -201,7 +201,7 @@ resource "juju_integration" "gnocchi-memcache" { resource "juju_integration" "gnocchi-ceilometer" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.gnocchi.name diff --git a/juju/home-maas-focal/additional/07-ceilometer-agent.tf b/juju/home-maas-focal/additional/07-ceilometer-agent.tf index 5b0b80c..f6a6427 100644 --- a/juju/home-maas-focal/additional/07-ceilometer-agent.tf +++ b/juju/home-maas-focal/additional/07-ceilometer-agent.tf @@ -1,7 +1,7 @@ resource "juju_application" "ceilometer-agent" { name = "ceilometer-agent" - model = var.model-name + model = juju_model.openstack.name charm { name = "ceilometer-agent" @@ -17,7 +17,7 @@ resource "juju_application" "ceilometer-agent" { resource "juju_integration" "compute-ceilometer" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.nova-compute-kvm.name @@ -32,7 +32,7 @@ resource "juju_integration" "compute-ceilometer" { resource "juju_integration" "ceilometer-agent-rmq" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.ceilometer-agent.name diff --git a/juju/home-maas-focal/additional/09-filebeat.tf b/juju/home-maas-focal/additional/09-filebeat.tf index b7a2543..b69b350 100644 --- a/juju/home-maas-focal/additional/09-filebeat.tf +++ b/juju/home-maas-focal/additional/09-filebeat.tf @@ -1,11 +1,12 @@ resource "juju_application" "filebeat" { name = "filebeat" - model = var.model-name + model = juju_model.openstack.name charm { name = "filebeat" channel = "latest/stable" + base = var.default-base } units = 0 @@ -56,7 +57,7 @@ resource "juju_application" "filebeat" { resource "juju_integration" "filebeat-integration" { for_each = toset(var.all_services) - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.filebeat.name @@ -72,7 +73,7 @@ resource "juju_integration" "filebeat-integration" { resource "juju_integration" "filebeat-graylog" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.filebeat.name diff --git a/juju/home-maas-focal/additional/09-landscape-client.tf b/juju/home-maas-focal/additional/09-landscape-client.tf index a94ec51..0fbc872 100644 --- a/juju/home-maas-focal/additional/09-landscape-client.tf +++ b/juju/home-maas-focal/additional/09-landscape-client.tf @@ -1,7 +1,7 @@ resource "juju_application" "landscape-client-bionic" { name = "landscape-client-bionic" - model = var.model-name + model = juju_model.openstack.name charm { name = "landscape-client" @@ -47,7 +47,7 @@ resource "juju_application" "landscape-client-bionic" { resource "juju_application" "landscape-client" { name = "landscape-client" - model = var.model-name + model = juju_model.openstack.name charm { name = "landscape-client" @@ -75,7 +75,7 @@ resource "juju_application" "landscape-client" { resource "juju_integration" "landscape-client-integration" { for_each = toset(var.all_services) - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.landscape-client.name diff --git a/juju/home-maas-focal/additional/09-nrpe.tf b/juju/home-maas-focal/additional/09-nrpe.tf new file mode 100644 index 0000000..b508bd5 --- /dev/null +++ b/juju/home-maas-focal/additional/09-nrpe.tf @@ -0,0 +1,158 @@ +resource "juju_application" "nrpe-host" { + name = "nrpe-host" + + model = juju_model.openstack.name + + charm { + name = "nrpe" + channel = "latest/stable" + base = var.default-base + } + + units = 0 + + endpoint_bindings = [{ + space = var.oam-space + }] + + config = { + nagios_hostname_type = "host" + nagios_host_context = var.nagios-context + xfs_errors = "30" + netlinks = "- bond0 mtu:1500 speed:1000, - bond1 mtu:9000 speed:50000" + } +} + +resource "juju_application" "nrpe-cont" { + name = "nrpe-container" + + model = juju_model.openstack.name + + charm { + name = "nrpe" + channel = "latest/stable" + base = var.default-base + } + + units = 0 + + endpoint_bindings = [{ + space = var.oam-space + }] + + config = { + nagios_hostname_type = "unit" + nagios_host_context = var.nagios-context + disk_root = "" + load = "" + swap = "" + swap_activity = "" + mem = "" + } +} + +locals { + cont_apps = [ + "vault", + "etcd", + "keystone", + "glance", + "cinder", + "heat", + "ceph-mon", + "neutron-api", + "rabbitmq-server", + "openstack-dashboard", + "nova-cloud-controller", + ] +} + +resource "juju_integration" "nrpe-cont-integration" { + for_each = toset(local.cont_apps) + + model = juju_model.openstack.name + + application { + name = juju_application.nrpe-cont.name + endpoint = "nrpe-external-master" + } + + application { + name = "${each.value}" + endpoint = "nrpe-external-master" + } +} + +locals { + cont_apps_info = [ + "placement", + "memcached", + ] +} + +resource "juju_integration" "nrpe-cont-info-integration" { + for_each = toset(local.cont_apps_info) + + model = juju_model.openstack.name + + application { + name = juju_application.nrpe-cont.name + endpoint = "general-info" + } + + application { + name = "${each.value}" + endpoint = "juju-info" + } +} + +locals { + host_apps = [ + "nova-compute-kvm", + "neutron-gateway", + ] +} + +resource "juju_integration" "nrpe-host-integration" { + for_each = toset(local.host_apps) + + model = juju_model.openstack.name + + application { + name = juju_application.nrpe-host.name + endpoint = "nrpe-external-master" + } + + application { + name = "${each.value}" + endpoint = "nrpe-external-master" + } +} + +resource "juju_integration" "nrpe-cont-nagios" { + + model = juju_model.openstack.name + + application { + name = juju_application.nrpe-cont.name + endpoint = "monitors" + } + + application { + offer_url = juju_offer.nagios.url + } +} + +resource "juju_integration" "nrpe-host-nagios" { + + model = juju_model.openstack.name + + application { + name = juju_application.nrpe-host.name + endpoint = "monitors" + } + + application { + offer_url = juju_offer.nagios.url + } +} diff --git a/juju/home-maas-focal/additional/09-telegraf.tf b/juju/home-maas-focal/additional/09-telegraf.tf index 4a78467..ffcfbc5 100644 --- a/juju/home-maas-focal/additional/09-telegraf.tf +++ b/juju/home-maas-focal/additional/09-telegraf.tf @@ -1,11 +1,12 @@ resource "juju_application" "telegraf" { name = "telegraf" - model = var.model-name + model = juju_model.openstack.name charm { name = "telegraf" channel = "latest/stable" + base = var.default-base } units = 0 @@ -68,7 +69,7 @@ locals { resource "juju_integration" "telegraf-integration" { for_each = toset(local.physical_apps) - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.telegraf.name @@ -83,7 +84,7 @@ resource "juju_integration" "telegraf-integration" { resource "juju_integration" "telegraf-grafana" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.telegraf.name @@ -97,7 +98,7 @@ resource "juju_integration" "telegraf-grafana" { resource "juju_integration" "telegraf-prometheus" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.telegraf.name diff --git a/juju/home-maas-focal/bundle.yaml b/juju/home-maas-focal/bundle.yaml new file mode 100644 index 0000000..e85024e --- /dev/null +++ b/juju/home-maas-focal/bundle.yaml @@ -0,0 +1,21 @@ +variables: + oam-space: &oam-space oam + internal-space: &internal-space oam + +applications: + cinder: + charm: ch:cinder + channel: ussuri/stable + series: focal + bindings: + "": *oam-space + num_units: 0 + etcd: + charm: ch:etcd + channel: 1.29/stable + series: focal + bindings: + "": *oam-space + cluster: *internal-space + db: *internal-space + num_units: 0 diff --git a/juju/home-maas-focal/controller/40-model.tf b/juju/home-maas-focal/controller/40-model.tf new file mode 100644 index 0000000..ea9a8ca --- /dev/null +++ b/juju/home-maas-focal/controller/40-model.tf @@ -0,0 +1,3 @@ +data "juju_model" "controller" { + name = "controller" +} diff --git a/juju/home-maas-focal/controller/41-juju-controller.tf b/juju/home-maas-focal/controller/41-juju-controller.tf new file mode 100644 index 0000000..083cad5 --- /dev/null +++ b/juju/home-maas-focal/controller/41-juju-controller.tf @@ -0,0 +1,20 @@ +resource "juju_application" "juju-server" { + name = "juju-server" + + model = data.juju_model.controller.name + + charm { + name = "ubuntu" + channel = var.ubuntu_channel + revision = var.ubuntu_revision + base = var.default-base + } + + units = 3 + + placement = "${join(",", sort([ + data.juju_machine.c0.machine_id, + data.juju_machine.c1.machine_id, + data.juju_machine.c2.machine_id, + ]))}" +} diff --git a/juju/home-maas-focal/controller/41-machines.tf b/juju/home-maas-focal/controller/41-machines.tf new file mode 100644 index 0000000..ff6bdf0 --- /dev/null +++ b/juju/home-maas-focal/controller/41-machines.tf @@ -0,0 +1,12 @@ +data "juju_machine" "c0" { + model = data.juju_model.controller.name + machine_id = "0" +} +data "juju_machine" "c1" { + model = data.juju_model.controller.name + machine_id = "1" +} +data "juju_machine" "c2" { + model = data.juju_model.controller.name + machine_id = "2" +} diff --git a/juju/home-maas-focal/controller/43-filebeat.tf b/juju/home-maas-focal/controller/43-filebeat.tf new file mode 100644 index 0000000..9ac8092 --- /dev/null +++ b/juju/home-maas-focal/controller/43-filebeat.tf @@ -0,0 +1,84 @@ +resource "juju_application" "filebeat-ctrl" { + name = "filebeat" + + model = data.juju_model.controller.name + + charm { + name = "filebeat" + channel = "latest/stable" + base = var.default-base + } + + 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/NYGldD2kmBf3YgCqeLzHahsAEp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aNVDmedwo1SiL03uMoblOvWpMR/Y0j6rm7IgrMWUDXDPvoPGjMl2q1iTeyHkMZ + EyUJ8SKsaHh4jV9wp9KmC8C+9CwMukL7vM5w8cgvJoAwsp3Fn59AxWthN3XJYcnMfStkIuWg + R7U2r+a210W6vnUxU4oN0PmMcursYPyeV0NX/KQeUeNMwGTFB6QHS/anRaGQewijkrYYoTNt + fllxIu9XYmiBERQ/qPDlGRlOgVTd9xUfHFkzB52c70E= + =92oX + -----END PGP PUBLIC KEY BLOCK----- + EOF + } +} + +resource "juju_integration" "filebeat-ctrl-integration" { + + model = data.juju_model.controller.name + + application { + name = juju_application.filebeat-ctrl.name + endpoint = "beats-host" + } + + application { + name = juju_application.juju-server.name + endpoint = "juju-info" + } +} + +resource "juju_integration" "filebeat-ctrl-graylog" { + + model = data.juju_model.controller.name + + application { + name = juju_application.filebeat-ctrl.name + endpoint = "logstash" + } + + application { + offer_url = juju_offer.graylog.url + } +} diff --git a/juju/home-maas-focal/controller/44-telegraf.tf b/juju/home-maas-focal/controller/44-telegraf.tf new file mode 100644 index 0000000..1862a9e --- /dev/null +++ b/juju/home-maas-focal/controller/44-telegraf.tf @@ -0,0 +1,106 @@ +resource "juju_application" "telegraf-ctrl" { + name = "telegraf" + + model = data.juju_model.controller.name + + charm { + name = "telegraf" + channel = "latest/stable" + base = var.default-base + } + + 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 focal main' + EOF + install_keys = <<-EOF + - | + -----BEGIN PGP PUBLIC KEY BLOCK----- + Version: SKS 1.1.6 + Comment: Hostname: keyserver.ubuntu.com + mQINBFcVSuIBEAC80aj0tAQ6+NhGV/bkSwu6Oj+BpDR50Be3uBv7ttdtvChL5zHTnaxjdK3h + LKSyrDLlmSOkffQ2uO7CxvqeF09MsHhyvrDDx0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TXWQYsg2UWsLA2PvTvwY8JxxMhUFgv12q2w7STntqJyi9PLItYNtbtKoS3 + 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 + } +} + + +resource "juju_integration" "telegraf-ctrl-integration" { + + model = data.juju_model.controller.name + + application { + name = juju_application.telegraf-ctrl.name + endpoint = "juju-info" + } + + application { + name = juju_application.juju-server.name + endpoint = "juju-info" + } +} + +resource "juju_integration" "telegraf-ctrl-grafana" { + + model = data.juju_model.controller.name + + application { + name = juju_application.telegraf-ctrl.name + endpoint = "dashboards" + } + + application { + offer_url = juju_offer.grafana.url + } +} + +resource "juju_integration" "telegraf-ctrl-prometheus" { + + model = data.juju_model.controller.name + + application { + name = juju_application.telegraf-ctrl.name + endpoint = "prometheus-client" + } + + application { + offer_url = juju_offer.prometheus.url + } +} diff --git a/juju/home-maas-focal/controller/45-nrpe.tf b/juju/home-maas-focal/controller/45-nrpe.tf new file mode 100644 index 0000000..617f62f --- /dev/null +++ b/juju/home-maas-focal/controller/45-nrpe.tf @@ -0,0 +1,46 @@ +resource "juju_application" "nrpe-ctrl" { + name = "nrpe" + + model = data.juju_model.controller.name + + charm { + name = "nrpe" + channel = "latest/stable" + base = var.default-base + } + + units = 0 + + endpoint_bindings = [{ + space = var.oam-space + }] +} + +resource "juju_integration" "nrpe-ctrl-integration" { + + model = data.juju_model.controller.name + + application { + name = juju_application.nrpe-ctrl.name + endpoint = "general-info" + } + + application { + name = juju_application.juju-server.name + endpoint = "juju-info" + } +} + +resource "juju_integration" "nrpe-ctrl-nagios" { + + model = data.juju_model.controller.name + + application { + name = juju_application.nrpe-ctrl.name + endpoint = "monitors" + } + + application { + offer_url = juju_offer.nagios.url + } +} diff --git a/juju/home-maas-focal/infra/30-model.tf b/juju/home-maas-focal/infra/30-model.tf new file mode 100644 index 0000000..6840d53 --- /dev/null +++ b/juju/home-maas-focal/infra/30-model.tf @@ -0,0 +1,18 @@ +resource "juju_model" "infra" { + name = var.infra-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-focal/infra/31-infra-server.tf b/juju/home-maas-focal/infra/31-infra-server.tf new file mode 100644 index 0000000..26ba633 --- /dev/null +++ b/juju/home-maas-focal/infra/31-infra-server.tf @@ -0,0 +1,19 @@ +resource "juju_application" "infra-server" { + name = "infra-server" + + model = juju_model.infra.name + + charm { + name = "ubuntu" + channel = var.ubuntu_channel + revision = var.ubuntu_revision + base = "ubuntu@22.04" + } + + units = length(var.infra-machines) + + placement = "${join(",", sort([ + for res in juju_machine.infra_machines : + res.machine_id + ]))}" +} diff --git a/juju/home-maas-focal/infra/31-machines.tf b/juju/home-maas-focal/infra/31-machines.tf new file mode 100644 index 0000000..48ef87a --- /dev/null +++ b/juju/home-maas-focal/infra/31-machines.tf @@ -0,0 +1,11 @@ +resource "juju_machine" "infra_machines" { + for_each = { + for index, machine in var.infra-machines: + machine.machine_id => machine + } + model = juju_model.infra.name + name = each.value.machine_id + ssh_address = join("@", ["ubuntu", each.value.name]) + private_key_file = "~/.local/share/juju/ssh/juju_id_rsa" + public_key_file = "~/.local/share/juju/ssh/juju_id_rsa.pub" +} diff --git a/juju/home-maas-focal/infra/33-filebeat.tf b/juju/home-maas-focal/infra/33-filebeat.tf new file mode 100644 index 0000000..634f0bd --- /dev/null +++ b/juju/home-maas-focal/infra/33-filebeat.tf @@ -0,0 +1,84 @@ +resource "juju_application" "filebeat-infra" { + name = "filebeat" + + model = juju_model.infra.name + + charm { + name = "filebeat" + channel = "latest/stable" + base = "ubuntu@22.04" + } + + 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 + AwECHgECF4AACgkQ0n1mbNiOQrRzjAgAlTUQ1mgo3nK6BGXbj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ERQ/qPDlGRlOgVTd9xUfHFkzB52c70E= + =92oX + -----END PGP PUBLIC KEY BLOCK----- + EOF + } +} + +resource "juju_integration" "filebeat-infra-integration" { + + model = juju_model.infra.name + + application { + name = juju_application.filebeat-infra.name + endpoint = "beats-host" + } + + application { + name = juju_application.infra-server.name + endpoint = "juju-info" + } +} + +resource "juju_integration" "filebeat-infra-graylog" { + + model = juju_model.infra.name + + application { + name = juju_application.filebeat-infra.name + endpoint = "logstash" + } + + application { + offer_url = juju_offer.graylog.url + } +} diff --git a/juju/home-maas-focal/infra/34-telegraf.tf b/juju/home-maas-focal/infra/34-telegraf.tf new file mode 100644 index 0000000..22ba035 --- /dev/null +++ b/juju/home-maas-focal/infra/34-telegraf.tf @@ -0,0 +1,106 @@ +resource "juju_application" "telegraf-infra" { + name = "telegraf" + + model = juju_model.infra.name + + charm { + name = "telegraf" + channel = "latest/stable" + base = "ubuntu@22.04" + } + + 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 focal 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+kN2nDmTDBMtNCyMu9oatdI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FqHLrbqz/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 + } +} + + +resource "juju_integration" "telegraf-infra-integration" { + + model = juju_model.infra.name + + application { + name = juju_application.telegraf-infra.name + endpoint = "juju-info" + } + + application { + name = juju_application.infra-server.name + endpoint = "juju-info" + } +} + +resource "juju_integration" "telegraf-infra-grafana" { + + model = juju_model.infra.name + + application { + name = juju_application.telegraf-infra.name + endpoint = "dashboards" + } + + application { + offer_url = juju_offer.grafana.url + } +} + +resource "juju_integration" "telegraf-infra-prometheus" { + + model = juju_model.infra.name + + application { + name = juju_application.telegraf-infra.name + endpoint = "prometheus-client" + } + + application { + offer_url = juju_offer.prometheus.url + } +} diff --git a/juju/home-maas-focal/infra/35-nrpe.tf b/juju/home-maas-focal/infra/35-nrpe.tf new file mode 100644 index 0000000..ce85446 --- /dev/null +++ b/juju/home-maas-focal/infra/35-nrpe.tf @@ -0,0 +1,52 @@ +resource "juju_application" "nrpe" { + name = "nrpe" + + model = juju_model.infra.name + + charm { + name = "nrpe" + channel = "latest/stable" + base = "ubuntu@22.04" + } + + units = 0 + + endpoint_bindings = [{ + space = var.oam-space + }] + + config = { + nagios_hostname_type = "host" + nagios_host_context = var.nagios-context + xfs_errors = "30" + } +} + +resource "juju_integration" "nrpe-integration" { + + model = juju_model.infra.name + + application { + name = juju_application.nrpe.name + endpoint = "general-info" + } + + application { + name = juju_application.infra-server.name + endpoint = "juju-info" + } +} + +resource "juju_integration" "nrpe-nagios" { + + model = juju_model.infra.name + + application { + name = juju_application.nrpe.name + endpoint = "monitors" + } + + application { + offer_url = juju_offer.nagios.url + } +} diff --git a/juju/home-maas-focal/lma/20-model.tf b/juju/home-maas-focal/lma/20-model.tf index 8f71cdd..fff9c7a 100644 --- a/juju/home-maas-focal/lma/20-model.tf +++ b/juju/home-maas-focal/lma/20-model.tf @@ -6,7 +6,7 @@ resource "juju_model" "lma" { } config = { - apt-mirror = "http://${var.apt_mirror}/archive.ubuntu.com/ubuntu" + apt-mirror = "http://archive.ubuntu.com/ubuntu" lxd-snap-channel = var.lxd-snap-channel container-image-metadata-url = "http://${var.apt_mirror}/lxd/" diff --git a/juju/home-maas-focal/lma/21-machines.tf b/juju/home-maas-focal/lma/21-machines.tf index ddc308f..7bb87ac 100644 --- a/juju/home-maas-focal/lma/21-machines.tf +++ b/juju/home-maas-focal/lma/21-machines.tf @@ -3,7 +3,7 @@ resource "juju_machine" "lma_machines" { for index, machine in var.lma-machines: machine.machine_id => machine } - model = var.lma-model-name + model = juju_model.lma.name name = each.value.machine_id constraints = each.value.constraints base = each.value.base diff --git a/juju/home-maas-focal/lma/22-graylog.tf b/juju/home-maas-focal/lma/22-graylog.tf index 12d844c..eb5093d 100644 --- a/juju/home-maas-focal/lma/22-graylog.tf +++ b/juju/home-maas-focal/lma/22-graylog.tf @@ -1,7 +1,7 @@ resource "juju_application" "graylog" { name = "graylog" - model = var.lma-model-name + model = juju_model.lma.name charm { name = "graylog" @@ -26,7 +26,7 @@ resource "juju_application" "graylog" { } resource "juju_machine" "graylog-mongodb" { - model = var.lma-model-name + model = juju_model.lma.name placement = join(":", ["lxd", juju_machine.lma_machines["200"].machine_id]) constraints = "spaces=oam" } @@ -35,7 +35,7 @@ resource "juju_machine" "graylog-mongodb" { resource "juju_application" "graylog-mongodb" { name = "graylog-mongodb" - model = var.lma-model-name + model = juju_model.lma.name charm { name = "mongodb" @@ -58,7 +58,7 @@ resource "juju_application" "graylog-mongodb" { resource "juju_integration" "graylog-mongodb" { - model = var.lma-model-name + model = juju_model.lma.name application { name = juju_application.graylog.name @@ -72,7 +72,7 @@ resource "juju_integration" "graylog-mongodb" { } resource "juju_offer" "graylog" { - model = var.lma-model-name + model = juju_model.lma.name application_name = juju_application.graylog.name endpoint = "beats" } diff --git a/juju/home-maas-focal/lma/23-elastic.tf b/juju/home-maas-focal/lma/23-elastic.tf index 9103ac3..56ae67c 100644 --- a/juju/home-maas-focal/lma/23-elastic.tf +++ b/juju/home-maas-focal/lma/23-elastic.tf @@ -1,7 +1,7 @@ resource "juju_application" "elasticsearch" { name = "elasticsearch" - model = var.lma-model-name + model = juju_model.lma.name charm { name = "elasticsearch" @@ -60,7 +60,7 @@ resource "juju_application" "elasticsearch" { resource "juju_integration" "graylog-elastic" { - model = var.lma-model-name + model = juju_model.lma.name application { name = juju_application.graylog.name diff --git a/juju/home-maas-focal/lma/24-grafana.tf b/juju/home-maas-focal/lma/24-grafana.tf index 50091ef..7710151 100644 --- a/juju/home-maas-focal/lma/24-grafana.tf +++ b/juju/home-maas-focal/lma/24-grafana.tf @@ -1,5 +1,5 @@ resource "juju_machine" "grafana" { - model = var.lma-model-name + model = juju_model.lma.name placement = join(":", ["lxd", juju_machine.lma_machines["201"].machine_id]) constraints = "spaces=oam" } @@ -7,7 +7,7 @@ resource "juju_machine" "grafana" { resource "juju_application" "grafana" { name = "grafana" - model = var.lma-model-name + model = juju_model.lma.name charm { name = "grafana" @@ -30,7 +30,7 @@ resource "juju_application" "grafana" { } resource "juju_offer" "grafana" { - model = var.lma-model-name + model = juju_model.lma.name application_name = juju_application.grafana.name endpoint = "dashboards" } diff --git a/juju/home-maas-focal/lma/25-prometheus.tf b/juju/home-maas-focal/lma/25-prometheus.tf index a332992..862ba58 100644 --- a/juju/home-maas-focal/lma/25-prometheus.tf +++ b/juju/home-maas-focal/lma/25-prometheus.tf @@ -1,5 +1,5 @@ resource "juju_machine" "prometheus" { - model = var.lma-model-name + model = juju_model.lma.name placement = join(":", ["lxd", juju_machine.lma_machines["201"].machine_id]) constraints = "spaces=oam" } @@ -7,7 +7,7 @@ resource "juju_machine" "prometheus" { resource "juju_application" "prometheus" { name = "prometheus" - model = var.lma-model-name + model = juju_model.lma.name charm { name = "prometheus2" @@ -25,7 +25,7 @@ resource "juju_application" "prometheus" { } resource "juju_integration" "prometheus-grafana" { - model = var.lma-model-name + model = juju_model.lma.name application { name = juju_application.prometheus.name @@ -40,7 +40,7 @@ resource "juju_integration" "prometheus-grafana" { resource "juju_integration" "ceph-mon-prometheus" { - model = var.model-name + model = juju_model.openstack.name application { name = juju_application.ceph-mon.name @@ -53,7 +53,7 @@ resource "juju_integration" "ceph-mon-prometheus" { } resource "juju_offer" "prometheus" { - model = var.lma-model-name + model = juju_model.lma.name application_name = juju_application.prometheus.name endpoint = "target" } diff --git a/juju/home-maas-focal/lma/26-nagios.tf b/juju/home-maas-focal/lma/26-nagios.tf new file mode 100644 index 0000000..f75bffa --- /dev/null +++ b/juju/home-maas-focal/lma/26-nagios.tf @@ -0,0 +1,37 @@ +resource "juju_machine" "nagios" { + model = juju_model.lma.name + placement = join(":", ["lxd", juju_machine.lma_machines["202"].machine_id]) + constraints = "spaces=oam" + base = "ubuntu@18.04" +} + +resource "juju_application" "nagios" { + name = "nagios" + + model = juju_model.lma.name + + charm { + name = "nagios" + channel = "latest/stable" + base = "ubuntu@18.04" + } + + units = 1 + + placement = juju_machine.nagios.machine_id + + endpoint_bindings = [{ + space = var.oam-space + }] + + config = { + enable_livestatus = "true" + check_timeout = 50 + } +} + +resource "juju_offer" "nagios" { + model = juju_model.lma.name + application_name = juju_application.nagios.name + endpoint = "monitors" +} diff --git a/juju/home-maas-focal/prometheus2.yaml b/juju/home-maas-focal/prometheus2.yaml new file mode 100644 index 0000000..a804ed3 --- /dev/null +++ b/juju/home-maas-focal/prometheus2.yaml @@ -0,0 +1,8 @@ +applications: + prometheus: + charm: ch:prometheus2 + channel: latest/stable + series: focal + bindings: + "": oam + num_units: 0 diff --git a/juju/home-maas-focal/terraform.tfvars b/juju/home-maas-focal/terraform.tfvars index 384617b..e8dfe33 100644 --- a/juju/home-maas-focal/terraform.tfvars +++ b/juju/home-maas-focal/terraform.tfvars @@ -1,4 +1,4 @@ -model-name = "cpe-focal" +openstack-model-name = "cpe-focal" machines = [ {machine_id=100,constraints="tags=control,asrock01"}, @@ -29,6 +29,13 @@ lma-machines = [ {machine_id=302,constraints="tags=compute,asrock01",base="ubuntu@18.04"}, ] +infra-machines = [ + {machine_id=0,name="asrock01"}, + {machine_id=1,name="asrock02"}, + {machine_id=2,name="asrock03"}, + {machine_id=3,name="asrock04"}, +] + osd-devices = "/dev/sdb /dev/sdc" nagios-context = "arif-nc01" @@ -70,3 +77,5 @@ vips = { placement = "10.0.1.223" radosgw = "10.0.1.224" } + +etcd_channel = "1.29/stable"