From 77a22c696f71de9cd7c02c62b31755deb6ee7a01 Mon Sep 17 00:00:00 2001 From: Shekhar Joshi Date: Fri, 30 Aug 2024 17:14:25 -0400 Subject: [PATCH] Add support for autobuild on RHEL --- examples/sdc_host_linux/README.md | 4 ++-- examples/sdc_host_linux/variables.tf | 4 ++-- modules/sdc_host_linux/README.md | 2 +- modules/sdc_host_linux/main.tf | 9 +++++---- modules/sdc_host_linux/variables.tf | 4 ++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/examples/sdc_host_linux/README.md b/examples/sdc_host_linux/README.md index 09b3fd3..c22cd1f 100644 --- a/examples/sdc_host_linux/README.md +++ b/examples/sdc_host_linux/README.md @@ -44,7 +44,7 @@ versions={ } scini = { url = "http://example.com/release/5.15.0-1-generic" - linux_distro = "RHEL" #"Ubuntu" + linux_distro = "RHEL9" #"Ubuntu" autobuild_scini = true } @@ -111,7 +111,7 @@ No resources. | [mdm\_ips](#input\_mdm\_ips) | all the mdms (either primary,secondary or virtual ips) in a comma separated list by cluster if unset will use the mdms of the cluster set in the provider block eg. ['10.10.10.5,10.10.10.6', '10.10.10.7,10.10.10.8'] | `list(string)` | `[]` | no | | [powerflex\_config](#input\_powerflex\_config) | Stores the configuration for terraform PowerFlex provider. |
object({
# Define the attributes of the configuration for terraform PowerFlex provider.
username = string
endpoint = string
password = string
})
| n/a | yes | | [remote\_host](#input\_remote\_host) | Stores the SSH credentials for connecting to the remote Linux host. |
object({
# Define the `user` attribute of the `remote` variable.
user = string
# Define the ssh `private_key` file with path for the SDC login user
private_key = optional(string, "")
# Define the ssh `certificate` file path, issued to the SDC login user
certificate = optional(string, "")
password = optional(string)
})
| n/a | yes | -| [scini](#input\_scini) | The SCINI module package related variables. |
object({
# The URL where the SCINI module package is located.
url = optional(string)
# specify distro where SDC will be deployed eg. RHEL, Ubuntu, SLES etc. as case sensitive
linux_distro = string
#allow to build scini on destination machine. This may not work on PowerFlex v3.X. Prerequisites here https://www.dell.com/support/kbdoc/en-us/000224134/how-to-on-demand-compilation-of-the-powerflex-sdc-driver
autobuild_scini = optional(bool, false)
})
| n/a | yes | +| [scini](#input\_scini) | The SCINI module package related variables. |
object({
# The URL where the SCINI module package is located. Ignored if autobuild_scini is true.
url = optional(string)
# specify distro where SDC will be deployed eg. RHEL9, Ubuntu etc. as case sensitive
linux_distro = string
#allow to build scini on destination machine. This may not work on PowerFlex v3.X. Prerequisites here https://www.dell.com/support/kbdoc/en-us/000224134/how-to-on-demand-compilation-of-the-powerflex-sdc-driver
autobuild_scini = optional(bool, false)
})
| n/a | yes | | [sdc\_pkg](#input\_sdc\_pkg) | configuration for SDC package like url to download package from, copy as local package or directory on remote server. One of local\_dir or remote\_dir will be used based on the variable use\_remote\_path |
object({
# examples "http://example.com/EMC-ScaleIO-sdc-3.6-700.103.Ubuntu.22.04.x86_64.tar", "ftp://username:password@ftpserver/path/to/file"
url = optional(string)
#the name of the SDC package for local.
pkg_name = optional(string)
#the name of the SDC package for remote machine. It should be emc-sdc-package.(tar/rpm)
remote_pkg_name = optional(string)
#local directory where the SDC package will be downloaded.
local_dir = optional(string)
#remote directory where the SDC package will be downloaded. (if use_remote_path is true)
remote_dir = optional(string, "/tmp")
# use the SDC package on remote machine path (where SDC is deployed)
use_remote_path = bool
# if SDC package is available in local directory, download can be skipped by setting to true
skip_download_sdc = optional(bool, false)
})
| n/a | yes | | [versions](#input\_versions) | n/a |
object({
pflex = string
kernel = string
})
| n/a | yes | diff --git a/examples/sdc_host_linux/variables.tf b/examples/sdc_host_linux/variables.tf index 5096a0c..8d033fe 100644 --- a/examples/sdc_host_linux/variables.tf +++ b/examples/sdc_host_linux/variables.tf @@ -58,9 +58,9 @@ variable "scini" { description = "The SCINI module package related variables." type = object({ - # The URL where the SCINI module package is located. + # The URL where the SCINI module package is located. Ignored if autobuild_scini is true. url = optional(string) - # specify distro where SDC will be deployed eg. RHEL, Ubuntu, SLES etc. as case sensitive + # specify distro where SDC will be deployed eg. RHEL9, Ubuntu etc. as case sensitive linux_distro = string #allow to build scini on destination machine. This may not work on PowerFlex v3.X. Prerequisites here https://www.dell.com/support/kbdoc/en-us/000224134/how-to-on-demand-compilation-of-the-powerflex-sdc-driver autobuild_scini = optional(bool, false) diff --git a/modules/sdc_host_linux/README.md b/modules/sdc_host_linux/README.md index 012bb64..a795bfe 100644 --- a/modules/sdc_host_linux/README.md +++ b/modules/sdc_host_linux/README.md @@ -88,7 +88,7 @@ No modules. | [ip](#input\_ip) | Stores the IP address of the remote Linux host. | `string` | n/a | yes | | [mdm\_ips](#input\_mdm\_ips) | all the mdms (either primary,secondary or virtual ips) in a comma separated list by cluster if unset will use the mdms of the cluster set in the provider block eg. ['10.10.10.5,10.10.10.6', '10.10.10.7,10.10.10.8'] | `list(string)` | n/a | yes | | [remote\_host](#input\_remote\_host) | Stores the SSH credentials for connecting to the remote Linux host. |
object({
# Define the `user` attribute of the `remote` variable.
user = string
# Define the ssh `private_key` file with path for the SDC login user
private_key = optional(string, "")
# Define the ssh `certificate` file path, issued to the SDC login user
certificate = optional(string, "")
password = optional(string)
})
| n/a | yes | -| [scini](#input\_scini) | The SCINI module package related variables. |
object({
# The URL where the SCINI module package is located.
url = optional(string)
# specify distro where SDC will be deployed eg. RHEL, Ubuntu, SLES etc. as case sensitive
linux_distro = string
#allow to build scini on destination machine. This may not work on PowerFlex v3.X. Prerequisites here https://www.dell.com/support/kbdoc/en-us/000224134/how-to-on-demand-compilation-of-the-powerflex-sdc-driver
autobuild_scini = optional(bool, false)
})
| n/a | yes | +| [scini](#input\_scini) | The SCINI module package related variables. |
object({
# The URL where the SCINI module package is located. Ignored if autobuild_scini is true.
url = optional(string)
# specify distro where SDC will be deployed eg. RHEL9, Ubuntu etc. as case sensitive
linux_distro = string
#allow to build scini on destination machine. This may not work on PowerFlex v3.X. Prerequisites here https://www.dell.com/support/kbdoc/en-us/000224134/how-to-on-demand-compilation-of-the-powerflex-sdc-driver
autobuild_scini = optional(bool, false)
})
| n/a | yes | | [sdc\_pkg](#input\_sdc\_pkg) | configuration for SDC package like url to download package from, copy as local package or directory on remote server. One of local\_dir or remote\_dir will be used based on the variable use\_remote\_path |
object({
# examples "http://example.com/EMC-ScaleIO-sdc-3.6-700.103.Ubuntu.22.04.x86_64.tar", "ftp://username:password@ftpserver/path/to/file"
url = optional(string)
#the name of the SDC package for local.
pkg_name = optional(string)
#the name of the SDC package for remote machine. It should be emc-sdc-package.(tar/rpm)
remote_pkg_name = optional(string)
#local directory where the SDC package will be downloaded.
local_dir = optional(string)
#remote directory where the SDC package will be downloaded. (if use_remote_path is true)
remote_dir = optional(string, "/tmp")
# use the SDC package on remote machine path (where SDC is deployed)
use_remote_path = bool
# if SDC package is available in local directory, download can be skipped by setting to true
skip_download_sdc = optional(bool, false)
})
| n/a | yes | | [versions](#input\_versions) | n/a |
object({
pflex = string
kernel = string
})
| n/a | yes | diff --git a/modules/sdc_host_linux/main.tf b/modules/sdc_host_linux/main.tf index 4e28c47..996d9dd 100644 --- a/modules/sdc_host_linux/main.tf +++ b/modules/sdc_host_linux/main.tf @@ -154,7 +154,7 @@ resource terraform_data sdc_pkg_remote { # # STEP 3 - install pre-requisites (scini module) # # provisioner to install scini module on SDC resource "terraform_data" "linux_scini" { - count = ( var.scini.linux_distro == "RHEL" || var.scini.autobuild_scini) ? 0 : 1 + count = var.scini.autobuild_scini ? 0 : 1 connection { type = "ssh" user = self.output.user.name @@ -177,12 +177,13 @@ resource "terraform_data" "linux_scini" { } ip = var.ip scini_url = var.scini.url + distro = var.scini.linux_distro } provisioner "remote-exec" { inline = [ - "mkdir -p /bin/emc/scaleio/scini_sync/driver_cache/Ubuntu/${local.pflex_v}/${local.kernel_v}", - "wget ${self.output.scini_url}/scini.ko -P /bin/emc/scaleio/scini_sync/driver_cache/Ubuntu/${local.pflex_v}/${local.kernel_v}", + "mkdir -p /bin/emc/scaleio/scini_sync/driver_cache/${self.output.distro}/${local.pflex_v}/${local.kernel_v}", + "wget ${self.output.scini_url}/scini.ko -P /bin/emc/scaleio/scini_sync/driver_cache/${self.output.distro}/${local.pflex_v}/${local.kernel_v}", ] } provisioner "remote-exec" { @@ -196,7 +197,7 @@ resource "terraform_data" "linux_scini" { # # provisioner to install scini module on SDC resource "terraform_data" "linux_scini_auto" { # Execute when autobuild flag is set and if it is not RHEL - count = ( var.scini.linux_distro != "RHEL" && var.scini.autobuild_scini) ? 1 : 0 + count = var.scini.autobuild_scini ? 1 : 0 connection { type = "ssh" user = self.output.user.name diff --git a/modules/sdc_host_linux/variables.tf b/modules/sdc_host_linux/variables.tf index 3a1883e..36d0eda 100644 --- a/modules/sdc_host_linux/variables.tf +++ b/modules/sdc_host_linux/variables.tf @@ -47,9 +47,9 @@ variable "scini" { description = "The SCINI module package related variables." type = object({ - # The URL where the SCINI module package is located. + # The URL where the SCINI module package is located. Ignored if autobuild_scini is true. url = optional(string) - # specify distro where SDC will be deployed eg. RHEL, Ubuntu, SLES etc. as case sensitive + # specify distro where SDC will be deployed eg. RHEL9, Ubuntu etc. as case sensitive linux_distro = string #allow to build scini on destination machine. This may not work on PowerFlex v3.X. Prerequisites here https://www.dell.com/support/kbdoc/en-us/000224134/how-to-on-demand-compilation-of-the-powerflex-sdc-driver autobuild_scini = optional(bool, false)