liferay module and preprod project.

This commit is contained in:
Andrea Dell'Amico 2023-12-01 17:01:40 +01:00
parent a3fc3784b4
commit 7fcc551c85
Signed by untrusted user: andrea.dellamico
GPG Key ID: 147ABE6CEB9E20FF
7 changed files with 486 additions and 23 deletions

View File

@ -0,0 +1,24 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/terraform-provider-openstack/openstack" {
version = "1.53.0"
constraints = "~> 1.53.0"
hashes = [
"h1:ZSJPqrlaHQ3sj7wyJuPSG+NblFZbAA6Y0d3GjSJf3o8=",
"zh:09da7ca98ffd3de7b9ce36c4c13446212a6e763ba1162be71b50f95d453cb68e",
"zh:14041bcbb87312411d88612056ed185650bfd01284b8ea0761ce8105a331708e",
"zh:35bf4c788fdbc17c8e40ebc7b33c7de4b45a2fa2efaa657b10f0e3bd37c9627f",
"zh:46ede8ef4cfa12d654c538afc1e1ec34a1f3e8eb4e986ee23dceae398b7176a6",
"zh:59675734990dab1e8d87997853ea75e8104bba730b3f5a7146ac735540c9d6bf",
"zh:6de52428849806498670e827b54810be7510a2a79449602c1aede4235a0ec036",
"zh:78b2a20601272afceffac8f8ca78a6b647b84196c0dd8dc710fae297f6be15a4",
"zh:7c41ed3a4fac09677e676ecf9f9edd1e38eef449e656cb01a848d2c799c6de8f",
"zh:852800228f4118a4aa6cfaa4468b851247cbed6f037fd204f08de69eb1edc149",
"zh:86d618e7f9a07d978b8bc4b190be350a00de64ec535f9c8f5dfe133542a55483",
"zh:963a9e72b66d8bcf43de9b14a674ae3ca3719ce2f829217f7a65b66fc3773397",
"zh:a8e72ab67795071bda61f99a6de3d2d40122fb51971768fd75e1324abe874ced",
"zh:ce1890cf3af17d569af3bc7673cec0a8f78e6f5d701767593f3d29c551f44848",
"zh:e6f1b96eb684f527a47f71923f268c86a36d7894751b31ee9e726d7502a639cd",
]
}

View File

@ -0,0 +1,87 @@
# Define required providers
terraform {
required_version = ">= 0.14.0"
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "~> 1.53.0"
}
}
}
data "terraform_remote_state" "privnet_dns_router" {
backend = "local"
config = {
path = "../project-setup/terraform.tfstate"
}
}
module "liferay" {
source = "../../modules/liferay"
default_security_group_name = "default_for_all"
# Provided in the output of the project setup
main_private_network_id = "23fd8a99-d551-4ada-8d3a-9859542ebb8c"
main_private_subnet_id = "cd77a2fd-4a36-4254-b1d0-70b3874c6d04"
dns_zone_id = "c1a4b4bc-f167-4387-855d-38f0f99ca05c"
os_project_data = {
id = "6fdc02e2827b405dad99f34698659742"
}
dns_zone = {
zone_name = "cloud-pre.d4science.org."
email = "postmaster@isti.cnr.it"
description = "DNS primary zone for the d4s-pre-cloud project"
ttl = 8600
id = "c1a4b4bc-f167-4387-855d-38f0f99ca05c"
}
main_private_network = {
name = "d4s-pre-cloud-main"
description = "D4Science Preprod private network (use this as the main network)"
}
main_private_subnet = {
name = "d4s-pre-cloud-main-subnet"
description = "D4Science Preprod main private subnet"
cidr = "10.1.32.0/22"
gateway_ip = "10.1.32.1"
allocation_start = "10.1.32.100"
allocation_end = "10.1.35.254"
}
external_router = {
name = "d4s-pre-cloud-external-router"
description = "D4Science Preprod main router"
id = "cc26064a-bb08-4c0b-929f-d0cb39f934a3"
}
basic_services_ip = {
ca = "10.1.32.4"
ca_cidr = "10.1.32.4/32"
ssh_jump = "10.1.32.5"
ssh_jump_cidr = "10.1.32.5/32"
prometheus = "10.1.32.10"
prometheus_cidr = "10.1.32.10/32"
haproxy_l7_1 = "10.1.32.11"
haproxy_l7_1_cidr = "10.1.32.11/32"
haproxy_l7_2 = "10.1.32.12"
haproxy_l7_2_cidr = "10.1.32.12/32"
octavia_main = "10.1.32.20"
octavia_main_cidr = "10.1.32.20/32"
}
main_haproxy_l7_ip = ["10.1.32.11", "10.1.32.12"]
liferay_data = {
affinity_policy = "soft-anti-affinity"
srv_name = "lr62"
vm_count = 2
vm_flavor = "m1.large"
boot_vol_size = 30
}
}

View File

@ -0,0 +1,3 @@
provider "openstack" {
cloud = "d4s-pre"
}

View File

@ -0,0 +1,354 @@
{
"version": 4,
"terraform_version": "1.6.4",
"serial": 5,
"lineage": "2cef4407-f7f5-0a46-74de-03956dd178ed",
"outputs": {},
"resources": [
{
"mode": "data",
"type": "terraform_remote_state",
"name": "privnet_dns_router",
"provider": "provider[\"terraform.io/builtin/terraform\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"backend": "local",
"config": {
"value": {
"path": "../project-setup/terraform.tfstate"
},
"type": [
"object",
{
"path": "string"
}
]
},
"defaults": null,
"outputs": {
"value": {
"almalinux9_img": {
"name": "AlmaLinux-9.0-20220718",
"uuid": "541650fc-dd19-4f38-bb1d-7333ed9dd688"
},
"availability_zone_no_gpu_name": "cnr-isti-nova-a",
"availability_zone_with_gpu_name": "cnr-isti-nova-gpu-a",
"centos7_img": {
"name": "CentOS-7",
"uuid": "f0187a99-64f6-462a-ab5f-ef52fe62f2ca"
},
"dns_zone_id": "c1a4b4bc-f167-4387-855d-38f0f99ca05c",
"el7_datafile": "../../openstack_vm_data_scripts/el7.sh",
"external_gateway_ip": "146.48.30.241",
"external_network_id": "1d2ff137-6ff7-4017-be2b-0d6c4af2353b",
"external_network_name": "external-network",
"main_private_network_id": "23fd8a99-d551-4ada-8d3a-9859542ebb8c",
"main_region_name": "isti_area_pi_1",
"main_subnet_network_id": "cd77a2fd-4a36-4254-b1d0-70b3874c6d04",
"mtu_size_value": 8942,
"resolvers_ip": [
"146.48.29.97",
"146.48.29.98",
"146.48.29.99"
],
"ssh_sources_list": {
"d4s_vpn_1_cidr": "146.48.122.27/32",
"d4s_vpn_2_cidr": "146.48.122.49/32",
"infrascience_net_cidr": "146.48.122.0/23",
"s2i2s_vpn_1_cidr": "146.48.28.10/32",
"s2i2s_vpn_2_cidr": "146.48.28.11/32",
"shell_d4s_cidr": "146.48.122.95/32"
},
"ubuntu1804_datafile": "../../openstack_vm_data_scripts/ubuntu1804.sh",
"ubuntu1804_img": {
"name": "Ubuntu-Bionic-18.04",
"uuid": "7ed6a2cd-2b07-482e-8ce4-f018dff16c89"
},
"ubuntu2204_datafile": "../../openstack_vm_data_scripts/ubuntu2204.sh",
"ubuntu2204_img": {
"name": "Ubuntu-Jammy-22.04",
"uuid": "54768889-8556-4be4-a2eb-82a4d9b34627"
}
},
"type": [
"object",
{
"almalinux9_img": [
"map",
"string"
],
"availability_zone_no_gpu_name": "string",
"availability_zone_with_gpu_name": "string",
"centos7_img": [
"map",
"string"
],
"dns_zone_id": "string",
"el7_datafile": "string",
"external_gateway_ip": "string",
"external_network_id": "string",
"external_network_name": "string",
"main_private_network_id": "string",
"main_region_name": "string",
"main_subnet_network_id": "string",
"mtu_size_value": "number",
"resolvers_ip": [
"list",
"string"
],
"ssh_sources_list": [
"map",
"string"
],
"ubuntu1804_datafile": "string",
"ubuntu1804_img": [
"map",
"string"
],
"ubuntu2204_datafile": "string",
"ubuntu2204_img": [
"map",
"string"
]
}
]
},
"workspace": null
},
"sensitive_attributes": []
}
]
},
{
"module": "module.liferay",
"mode": "managed",
"type": "openstack_compute_instance_v2",
"name": "liferay",
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"access_ip_v4": "10.1.32.184",
"access_ip_v6": "",
"admin_pass": null,
"all_metadata": {},
"all_tags": [],
"availability_zone": "cnr-isti-nova-a",
"availability_zone_hints": "cnr-isti-nova-a",
"block_device": [
{
"boot_index": 0,
"delete_on_termination": false,
"destination_type": "volume",
"device_type": "",
"disk_bus": "",
"guest_format": "",
"multiattach": false,
"source_type": "image",
"uuid": "7ed6a2cd-2b07-482e-8ce4-f018dff16c89",
"volume_size": 30,
"volume_type": ""
}
],
"config_drive": null,
"created": "2023-12-01 15:18:47 +0000 UTC",
"flavor_id": "9",
"flavor_name": "m1.large",
"floating_ip": null,
"force_delete": false,
"id": "c94c2c05-b75a-4af9-8e4d-a9e689db34c2",
"image_id": "Attempt to boot from volume - no image supplied",
"image_name": null,
"key_pair": "adellam",
"metadata": null,
"name": "lr62-01",
"network": [
{
"access_network": false,
"fixed_ip_v4": "10.1.32.184",
"fixed_ip_v6": "",
"floating_ip": "",
"mac": "fa:16:3e:b7:f7:42",
"name": "d4s-pre-cloud-main",
"port": "",
"uuid": "23fd8a99-d551-4ada-8d3a-9859542ebb8c"
},
{
"access_network": false,
"fixed_ip_v4": "192.168.3.34",
"fixed_ip_v6": "",
"floating_ip": "",
"mac": "fa:16:3e:d1:6c:e0",
"name": "postgresql-srv-net",
"port": "",
"uuid": "e25395f4-f1aa-4819-b5a5-36d25ee5af54"
}
],
"network_mode": null,
"personality": [],
"power_state": "active",
"region": "isti_area_pi_1",
"scheduler_hints": [
{
"additional_properties": null,
"build_near_host_ip": "",
"different_cell": [],
"different_host": [],
"group": "ea1d150d-3dc0-4d03-a09f-b40069d0b70c",
"query": [],
"same_host": [],
"target_cell": ""
}
],
"security_groups": [
"default_for_all",
"restricted_web_service",
"traffic_from_the_main_load_balancers"
],
"stop_before_destroy": false,
"tags": null,
"timeouts": null,
"updated": "2023-12-01 15:20:35 +0000 UTC",
"user_data": "47d4769e61324c305c4b70ed6673de4fad84150d",
"vendor_options": [],
"volume": []
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxODAwMDAwMDAwMDAwLCJkZWxldGUiOjE4MDAwMDAwMDAwMDAsInVwZGF0ZSI6MTgwMDAwMDAwMDAwMH19",
"dependencies": [
"module.liferay.openstack_compute_servergroup_v2.liferay"
]
},
{
"index_key": 1,
"schema_version": 0,
"attributes": {
"access_ip_v4": "10.1.34.124",
"access_ip_v6": "",
"admin_pass": null,
"all_metadata": {},
"all_tags": [],
"availability_zone": "cnr-isti-nova-a",
"availability_zone_hints": "cnr-isti-nova-a",
"block_device": [
{
"boot_index": 0,
"delete_on_termination": false,
"destination_type": "volume",
"device_type": "",
"disk_bus": "",
"guest_format": "",
"multiattach": false,
"source_type": "image",
"uuid": "7ed6a2cd-2b07-482e-8ce4-f018dff16c89",
"volume_size": 30,
"volume_type": ""
}
],
"config_drive": null,
"created": "2023-12-01 15:18:48 +0000 UTC",
"flavor_id": "9",
"flavor_name": "m1.large",
"floating_ip": null,
"force_delete": false,
"id": "b7968935-494d-49e3-b7a9-20db4e793d0a",
"image_id": "Attempt to boot from volume - no image supplied",
"image_name": null,
"key_pair": "adellam",
"metadata": null,
"name": "lr62-02",
"network": [
{
"access_network": false,
"fixed_ip_v4": "10.1.34.124",
"fixed_ip_v6": "",
"floating_ip": "",
"mac": "fa:16:3e:eb:cd:cd",
"name": "d4s-pre-cloud-main",
"port": "",
"uuid": "23fd8a99-d551-4ada-8d3a-9859542ebb8c"
},
{
"access_network": false,
"fixed_ip_v4": "192.168.1.205",
"fixed_ip_v6": "",
"floating_ip": "",
"mac": "fa:16:3e:2e:9a:09",
"name": "postgresql-srv-net",
"port": "",
"uuid": "e25395f4-f1aa-4819-b5a5-36d25ee5af54"
}
],
"network_mode": null,
"personality": [],
"power_state": "active",
"region": "isti_area_pi_1",
"scheduler_hints": [
{
"additional_properties": null,
"build_near_host_ip": "",
"different_cell": [],
"different_host": [],
"group": "ea1d150d-3dc0-4d03-a09f-b40069d0b70c",
"query": [],
"same_host": [],
"target_cell": ""
}
],
"security_groups": [
"default_for_all",
"restricted_web_service",
"traffic_from_the_main_load_balancers"
],
"stop_before_destroy": false,
"tags": null,
"timeouts": null,
"updated": "2023-12-01 15:19:57 +0000 UTC",
"user_data": "47d4769e61324c305c4b70ed6673de4fad84150d",
"vendor_options": [],
"volume": []
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxODAwMDAwMDAwMDAwLCJkZWxldGUiOjE4MDAwMDAwMDAwMDAsInVwZGF0ZSI6MTgwMDAwMDAwMDAwMH19",
"dependencies": [
"module.liferay.openstack_compute_servergroup_v2.liferay"
]
}
]
},
{
"module": "module.liferay",
"mode": "managed",
"type": "openstack_compute_servergroup_v2",
"name": "liferay",
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "ea1d150d-3dc0-4d03-a09f-b40069d0b70c",
"members": [],
"name": "liferay",
"policies": [
"soft-anti-affinity"
],
"region": "isti_area_pi_1",
"rules": [
{
"max_server_per_host": 0
}
],
"value_specs": null
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
}
],
"check_results": null
}

View File

@ -0,0 +1,10 @@
variable "liferay_data" {
type = map(string)
default = {
affinity_policy = "soft-anti-affinity"
srv_name = "lr62"
vm_count = 1
vm_flavor = "m1.large"
boot_vol_size = 30
}
}

View File

@ -5,15 +5,15 @@
#
resource "openstack_compute_servergroup_v2" "liferay" {
name = "liferay"
policies = ["anti-affinity"]
policies = [var.liferay_data.affinity_policy]
}
# Instance
# Instance(s)
resource "openstack_compute_instance_v2" "liferay" {
count = var.liferay_data.vm_count
name = format("%s-%02d", var.liferay_data.name, count.index + 1)
name = format("%s-%02d", var.liferay_data.srv_name, count.index + 1)
availability_zone_hints = var.availability_zones_names.availability_zone_no_gpu
flavor_name = var.liferay_data.flavor
flavor_name = var.liferay_data.vm_flavor
key_pair = module.ssh_settings.ssh_key_name
security_groups = [var.default_security_group_name, "traffic_from_the_main_load_balancers", "restricted_web_service"]
scheduler_hints {
@ -22,7 +22,7 @@ resource "openstack_compute_instance_v2" "liferay" {
block_device {
uuid = var.ubuntu_1804.uuid
source_type = "image"
volume_size = 10
volume_size = var.liferay_data.boot_vol_size
boot_index = 0
destination_type = "volume"
delete_on_termination = false
@ -30,8 +30,9 @@ resource "openstack_compute_instance_v2" "liferay" {
network {
name = var.main_private_network.name
fixed_ip_v4 = var.liferay_ip.* [count.index]
}
network {
name = var.shared_postgresql_server_data.network_name
}
user_data = file("${var.ubuntu1804_data_file}")
}

View File

@ -9,19 +9,3 @@ required_version = ">= 0.14.0"
}
}
data "terraform_remote_state" "privnet_dns_router" {
backend = "local"
config = {
path = "../project-setup/terraform.tfstate"
}
}
data "terraform_remote_state" "basic_infrastructure" {
backend = "local"
config = {
path = "../basic-infrastructure/terraform.tfstate"
}
}