Manila shares for the dev CCP.

This commit is contained in:
Andrea Dell'Amico 2024-03-25 16:45:05 +01:00
parent c23c8c3f74
commit 3c04dace24
Signed by: andrea.dellamico
GPG Key ID: 147ABE6CEB9E20FF
5 changed files with 1690 additions and 0 deletions

View File

@ -0,0 +1,55 @@
# NFS shares required by the CCP
# Create a NFS share for the repository data
#
resource "openstack_sharedfilesystem_share_v2" "ccp_dev_repository_data" {
name = "ccp_dev_repository_data"
description = "NFS share for the CCP repository data"
share_proto = "NFS"
size = 5
}
# Allow access to the NFS share
resource "openstack_sharedfilesystem_share_access_v2" "ccp_dev_repository_nfs_access" {
for_each = var.swarm_manila_interfaces_ip
share_id = openstack_sharedfilesystem_share_v2.ccp_dev_repository_data.id
access_type = "ip"
access_to = each.value
access_level = "rw"
}
# NFS shares required by the CCP
# Create a NFS share for the method logs
#
resource "openstack_sharedfilesystem_share_v2" "ccp_dev_methods_logs" {
name = "ccp_dev_method_logs"
description = "NFS share for the CCP method logs"
share_proto = "NFS"
size = 1
}
# Allow access to the NFS share
resource "openstack_sharedfilesystem_share_access_v2" "ccp_dev_methods_logs_nfs_access" {
for_each = var.swarm_manila_interfaces_ip
share_id = openstack_sharedfilesystem_share_v2.ccp_dev_methods_logs.id
access_type = "ip"
access_to = each.value
access_level = "rw"
}
output "ccp_dev_repository_data" {
value = openstack_sharedfilesystem_share_v2.ccp_dev_repository_data
}
output "ccp_dev_repository_data_nfs_acls" {
value = openstack_sharedfilesystem_share_access_v2.ccp_dev_repository_nfs_access
sensitive = true
}
output "ccp_dev_methods_logs" {
value = openstack_sharedfilesystem_share_v2.ccp_dev_methods_logs
}
output "ccp_dev_methods_logs_access_nfs_acls" {
value = openstack_sharedfilesystem_share_access_v2.ccp_dev_methods_logs_nfs_access
sensitive = true
}

View File

@ -0,0 +1,51 @@
# 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"
}
}
# data "terraform_remote_state" "main_infrastructure" {
# backend = "local"
# config = {
# path = "../basic-infrastructure/terraform.tfstate"
# }
# }
# SSH settings
module "ssh_settings" {
source = "../../modules/ssh-key-ref"
}
#
# Uses common_variables as module
#
module "common_variables" {
source = "../../modules/common_variables"
}
variable "swarm_manila_interfaces_ip" {
type = map(string)
default = {
"mgr_1" = "172.17.2.74"
"mgr_2" = "172.17.3.218"
"mgr_3" = "172.17.2.230"
"worker_1" = "172.17.0.166"
"worker_2" = "172.17.2.171"
"worker_3" = "172.17.0.146"
"worker_4" = "172.17.1.195"
"worker_5" = "172.17.2.187"
}
}

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,82 @@
# NFS shares required by the CCP
# Create a NFS share for the repository data
#
resource "openstack_sharedfilesystem_share_v2" "ccp_production_repository_data" {
name = "ccp_production_repository_data"
description = "NFS share for the CCP repository data"
share_proto = "NFS"
size = 5000
}
# Allow access to the NFS share
resource "openstack_sharedfilesystem_share_access_v2" "ccp_production_repository_access_swarm_mgr" {
for_each = { for nfs_ip in data.terraform_remote_state.main_infrastructure.outputs.swarm_managers_nfs_ip_ports : join("", nfs_ip.all_fixed_ips) => nfs_ip }
share_id = openstack_sharedfilesystem_share_v2.ccp_production_repository_data.id
access_type = "ip"
access_to = each.key
access_level = "rw"
}
resource "openstack_sharedfilesystem_share_access_v2" "ccp_production_repository_access_swarm_workers" {
for_each = { for nfs_ip in data.terraform_remote_state.main_infrastructure.outputs.swarm_workers_nfs_ip_ports : join("", nfs_ip.all_fixed_ips) => nfs_ip }
share_id = openstack_sharedfilesystem_share_v2.ccp_production_repository_data.id
access_type = "ip"
access_to = each.key
access_level = "rw"
}
# NFS shares required by the CCP
# Create a NFS share for the method logs
#
resource "openstack_sharedfilesystem_share_v2" "ccp_production_methods_logs" {
name = "ccp_production_method_logs"
description = "NFS share for the CCP method logs"
share_proto = "NFS"
size = 1000
}
# Allow access to the NFS share
resource "openstack_sharedfilesystem_share_access_v2" "ccp_production_methods_logs_access_swarm_mgr" {
for_each = { for nfs_ip in data.terraform_remote_state.main_infrastructure.outputs.swarm_managers_nfs_ip_ports : join("", nfs_ip.all_fixed_ips) => nfs_ip }
share_id = openstack_sharedfilesystem_share_v2.ccp_production_methods_logs.id
access_type = "ip"
access_to = each.key
access_level = "rw"
}
resource "openstack_sharedfilesystem_share_access_v2" "ccp_production_methods_logs_access_swarm_workers" {
for_each = { for nfs_ip in data.terraform_remote_state.main_infrastructure.outputs.swarm_workers_nfs_ip_ports : join("", nfs_ip.all_fixed_ips) => nfs_ip }
share_id = openstack_sharedfilesystem_share_v2.ccp_production_methods_logs.id
access_type = "ip"
access_to = each.key
access_level = "rw"
}
output "ccp_production_repository_data" {
value = openstack_sharedfilesystem_share_v2.ccp_production_repository_data
}
output "ccp_production_repository_data_mgr_acls" {
value = openstack_sharedfilesystem_share_access_v2.ccp_production_repository_access_swarm_mgr
sensitive = true
}
output "ccp_production_repository_workers_acls" {
value = openstack_sharedfilesystem_share_access_v2.ccp_production_repository_access_swarm_workers
sensitive = true
}
output "ccp_production_methods_logs" {
value = openstack_sharedfilesystem_share_v2.ccp_production_methods_logs
}
output "ccp_production_methods_logs_access_swarm_mgr" {
value = openstack_sharedfilesystem_share_access_v2.ccp_production_methods_logs_access_swarm_mgr
sensitive = true
}
output "ccp_production_methods_logs_access_swarm_workers" {
value = openstack_sharedfilesystem_share_access_v2.ccp_production_methods_logs_access_swarm_workers
sensitive = true
}