diff --git a/README.md b/README.md index 96f9f9e0a..cc8822ce7 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ The directory structure of the repository. │ ├── ansible.pkvars.hcl │ ├── build.pkvars.hcl │ ├── common.pkvars.hcl +│ ├── proxy.pkvars.hcl │ ├── rhsm.pkvars.hcl │ ├── vsphere.pkvars.hcl │ ├── linux @@ -254,27 +255,21 @@ common_content_library_ovf = true common_content_library_destroy = true ``` -#### **vSphere Variables** +#### **Proxy Variables** -Edit the `/buils/vsphere.pkvars.hcl` file to configure the following: +Edit the `/builds/proxy.pkvars.hcl` file to configure the following: -* vSphere Endpoint and Credentials -* vSphere Settings +* SOCKS proxy settings used for connecting to Linux machine images. +* Credentials for the proxy server (Optional). -Example: `/builds/vsphere.pkvars.hcl` +Example: `/builds/proxy.pkvars.hcl` ``` -vsphere_endpoint = "sfo-w01-vc01.sfo.rainpole.io" -vsphere_username = "svc-packer-vsphere@rainpole.io" -vsphere_password = "" -vsphere_insecure_connection = true -vsphere_datacenter = "sfo-w01-dc01" -vsphere_cluster = "sfo-w01-cl01" -vsphere_datastore = "sfo-w01-cl01-ds-vsan01" -vsphere_network = "sfo-w01-seg-dhcp" -vsphere_folder = "sfo-w01-fd-templates" +communicator_proxy_host = "proxy.rainpole.io" +communicator_proxy_port = 1080 +communicator_proxy_username = "rainpole" +communicator_proxy_password = "" ``` - #### **Red Hat Subscription Manager Variables** Edit the `/builds/redhat.pkvars.hcl` file to configure the following: @@ -290,6 +285,29 @@ rhsm_password = "" These variables are **only** used if you are performing a Red Hat Enterprise Linux Server build to register the image with Red Hat Subscription Manager and run a `sudo yum update -y` within the shell provisioner. Before the build completes, the machine image is unregistered from Red Hat Subscription Manager. + + +#### **vSphere Variables** + +Edit the `/buils/vsphere.pkvars.hcl` file to configure the following: + +* vSphere Endpoint and Credentials +* vSphere Settings + +Example: `/builds/vsphere.pkvars.hcl` + +``` +vsphere_endpoint = "sfo-w01-vc01.sfo.rainpole.io" +vsphere_username = "svc-packer-vsphere@rainpole.io" +vsphere_password = "" +vsphere_insecure_connection = true +vsphere_datacenter = "sfo-w01-dc01" +vsphere_cluster = "sfo-w01-cl01" +vsphere_datastore = "sfo-w01-cl01-ds-vsan01" +vsphere_network = "sfo-w01-seg-dhcp" +vsphere_folder = "sfo-w01-fd-templates" +``` + #### **Machine Image Variables** Edit the `*.auto.pkvars.hcl` file in each `builds//` folder to configure the following virtual machine hardware settings, as required: @@ -308,6 +326,18 @@ Edit the `*.auto.pkvars.hcl` file in each `builds//` folder to conf Some of the variables may include sensitive information and environmental data that you would prefer not to save to clear text files. You can add there to environmental variables using the example below: ``` +export PKR_VAR_ansible_username="" +export PKR_VAR_ansible_key="" +export PKR_VAR_build_username="" +export PKR_VAR_build_password="" +export PKR_VAR_build_password="" +export PKR_VAR_build_key="" +export PKR_VAR_communicator_proxy_host = "" +export PKR_VAR_communicator_proxy_port = "" +export PKR_VAR_communicator_proxy_username = "" +export PKR_VAR_communicator_proxy_password = "communicator_proxy_password>" +export PKR_VAR_rhsm_username="" +export PKR_VAR_rhsm_password="" export PKR_VAR_vsphere_endpoint="" export PKR_VAR_vsphere_username="" export PKR_VAR_vsphere_password="" @@ -316,14 +346,6 @@ export PKR_VAR_vsphere_cluster="" export PKR_VAR_vsphere_datastore=">" export PKR_VAR_vsphere_network="" export PKR_VAR_vsphere_folder="" -export PKR_VAR_build_username="" -export PKR_VAR_build_password="" -export PKR_VAR_build_password="" -export PKR_VAR_build_key="" -export PKR_VAR_ansible_username="" -export PKR_VAR_ansible_key="" -export PKR_VAR_rhsm_username="" -export PKR_VAR_rhsm_password="" ``` ## Step 4 - Modify the Configurations and Scripts @@ -485,4 +507,4 @@ Happy building!!! [vsphere-content-library]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-254B2CE8-20A8-43F0-90E8-3F6776C2C896.html [vsphere-guestosid]: https://vdc-download.vmware.com/vmwb-repository/dcr-public/b50dcbbf-051d-4204-a3e7-e1b618c1e384/538cf2ec-b34f-4bae-a332-3820ef9e7773/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html [vsphere-efi]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.security.doc/GUID-898217D4-689D-4EB5-866C-888353FE241C.html -[vsphere-upload]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.storage.doc/GUID-58D77EA5-50D9-4A8E-A15A-D7B3ABA11B87.html?hWord=N4IghgNiBcIK4AcIHswBMAEAzAlhApgM4gC+QA \ No newline at end of file +[vsphere-upload]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.storage.doc/GUID-58D77EA5-50D9-4A8E-A15A-D7B3ABA11B87.html?hWord=N4IghgNiBcIK4AcIHswBMAEAzAlhApgM4gC+QA diff --git a/build.sh b/build.sh index 32f0c31b7..4576e693a 100644 --- a/build.sh +++ b/build.sh @@ -26,6 +26,7 @@ menu_option_1() { -var-file="../../vsphere.pkrvars.hcl" \ -var-file="../../build.pkrvars.hcl" \ -var-file="../../ansible.pkrvars.hcl" \ + -var-file="../../proxy.pkrvars.hcl" \ -var-file="../../common.pkrvars.hcl" . ### All done. ### @@ -56,8 +57,9 @@ menu_option_2() { -var-file="../../vsphere.pkrvars.hcl" \ -var-file="../../build.pkrvars.hcl" \ -var-file="../../ansible.pkrvars.hcl" \ + -var-file="../../proxy.pkrvars.hcl" \ -var-file="../../common.pkrvars.hcl" . - + ### All done. ### echo "Done." } @@ -86,8 +88,9 @@ menu_option_3() { -var-file="../../vsphere.pkrvars.hcl" \ -var-file="../../build.pkrvars.hcl" \ -var-file="../../ansible.pkrvars.hcl" \ + -var-file="../../proxy.pkrvars.hcl" \ -var-file="../../common.pkrvars.hcl" . - + ### All done. ### echo "Done." } @@ -116,6 +119,7 @@ menu_option_4() { -var-file="../../vsphere.pkrvars.hcl" \ -var-file="../../build.pkrvars.hcl" \ -var-file="../../ansible.pkrvars.hcl" \ + -var-file="../../proxy.pkrvars.hcl" \ -var-file="../../common.pkrvars.hcl" \ -var-file="../../rhsm.pkrvars.hcl" . @@ -147,6 +151,7 @@ menu_option_5() { -var-file="../../vsphere.pkrvars.hcl" \ -var-file="../../build.pkrvars.hcl" \ -var-file="../../ansible.pkrvars.hcl" \ + -var-file="../../proxy.pkrvars.hcl" \ -var-file="../../common.pkrvars.hcl" . ### All done. ### @@ -177,6 +182,7 @@ menu_option_6() { -var-file="../../vsphere.pkrvars.hcl" \ -var-file="../../build.pkrvars.hcl" \ -var-file="../../ansible.pkrvars.hcl" \ + -var-file="../../proxy.pkrvars.hcl" \ -var-file="../../common.pkrvars.hcl" . ### All done. ### @@ -203,6 +209,7 @@ menu_option_7() { -var-file="../../vsphere.pkrvars.hcl" \ -var-file="../../build.pkrvars.hcl" \ -var-file="../../ansible.pkrvars.hcl" \ + -var-file="../../proxy.pkrvars.hcl" \ -var-file="../../common.pkrvars.hcl" . ### All done. ### @@ -233,6 +240,7 @@ menu_option_8() { -var-file="../../vsphere.pkrvars.hcl" \ -var-file="../../build.pkrvars.hcl" \ -var-file="../../ansible.pkrvars.hcl" \ + -var-file="../../proxy.pkrvars.hcl" \ -var-file="../../common.pkrvars.hcl" . ### All done. ### @@ -293,7 +301,7 @@ menu_option_10() { -var-file="../../vsphere.pkrvars.hcl" \ -var-file="../../build.pkrvars.hcl" \ -var-file="../../common.pkrvars.hcl" . - + ### All done. ### echo "Done." } @@ -323,7 +331,7 @@ menu_option_11() { -var-file="../../vsphere.pkrvars.hcl" \ -var-file="../../build.pkrvars.hcl" \ -var-file="../../common.pkrvars.hcl" . - + ### All done. ### echo "Done." } @@ -382,7 +390,7 @@ menu_option_13() { -var-file="../../vsphere.pkrvars.hcl" \ -var-file="../../build.pkrvars.hcl" \ -var-file="../../common.pkrvars.hcl" . - + ### All done. ### echo "Done." } @@ -412,7 +420,7 @@ menu_option_14() { -var-file="../../vsphere.pkrvars.hcl" \ -var-file="../../build.pkrvars.hcl" \ -var-file="../../common.pkrvars.hcl" . - + ### All done. ### echo "Done." } @@ -471,7 +479,7 @@ menu_option_16() { -var-file="../../vsphere.pkrvars.hcl" \ -var-file="../../build.pkrvars.hcl" \ -var-file="../../common.pkrvars.hcl" . - + ### All done. ### echo "Done." } @@ -501,7 +509,7 @@ menu_option_17() { -var-file="../../vsphere.pkrvars.hcl" \ -var-file="../../build.pkrvars.hcl" \ -var-file="../../common.pkrvars.hcl" . - + ### All done. ### echo "Done." } @@ -538,7 +546,7 @@ until [ "$selection" = "0" ]; do echo " / /_/ / __ / ___/ //_/ _ \/ ___/ / __ / / / / / / __ / ___/ " echo " / ____/ /_/ / /__/ ,< / __/ / / /_/ / /_/ / / / /_/ (__ ) " echo "/_/ \__,_/\___/_/|_|\___/_/ /_____/\__,_/_/_/\__,_/____/ " - echo "" + echo "" echo -n " Select a HashiCorp Packer build for VMware vSphere:" echo "" echo "" @@ -561,7 +569,7 @@ until [ "$selection" = "0" ]; do echo " 12 - Windows Server 2019 - All" echo " 13 - Windows Server 2019 - Standard Only" echo " 14 - Windows Server 2019 - Datacenter Only" - echo " 15 - Windows Server 2016 - All" + echo " 15 - Windows Server 2016 - All" echo " 16 - Windows Server 2016 - Standard Only" echo " 17 - Windows Server 2016 - Datacenter Only" echo "" diff --git a/builds/linux/almalinux-8/linux-almalinux.pkr.hcl b/builds/linux/almalinux-8/linux-almalinux.pkr.hcl index c9f83a89e..ec10b390c 100644 --- a/builds/linux/almalinux-8/linux-almalinux.pkr.hcl +++ b/builds/linux/almalinux-8/linux-almalinux.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: AlmaLinux 8 template using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -82,11 +82,15 @@ source "vsphere-iso" "linux-almalinux" { shutdown_timeout = var.common_shutdown_timeout // Communicator Settings and Credentials - communicator = "ssh" - ssh_username = var.build_username - ssh_password = var.build_password - ssh_port = var.communicator_port - ssh_timeout = var.communicator_timeout + communicator = "ssh" + ssh_proxy_host = var.communicator_proxy_host + ssh_proxy_port = var.communicator_proxy_port + ssh_proxy_username = var.communicator_proxy_username + ssh_proxy_password = var.communicator_proxy_password + ssh_username = var.build_username + ssh_password = var.build_password + ssh_port = var.communicator_port + ssh_timeout = var.communicator_timeout // Template and Content Library Settings convert_to_template = var.common_template_conversion diff --git a/builds/linux/almalinux-8/variables.pkr.hcl b/builds/linux/almalinux-8/variables.pkr.hcl index 545074a79..d227feecd 100644 --- a/builds/linux/almalinux-8/variables.pkr.hcl +++ b/builds/linux/almalinux-8/variables.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: AlmaLinux 8 variables using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -293,6 +293,31 @@ variable "build_key" { sensitive = true } +variable "communicator_proxy_host" { + type = string + description = "A SOCKS proxy host to use for SSH connection." + default = null +} + +variable "communicator_proxy_port" { + type = number + description = "A port of the SOCKS proxy." + default = null +} + +variable "communicator_proxy_username" { + type = string + description = "The optional username to authenticate with the proxy server." + default = null +} + +variable "communicator_proxy_password" { + type = string + description = "The optional password to use to authenticate with the proxy server." + sensitive = true + default = null +} + variable "communicator_port" { type = string description = "The port for the communicator protocol." diff --git a/builds/linux/centos-linux-8/linux-centos-linux.pkr.hcl b/builds/linux/centos-linux-8/linux-centos-linux.pkr.hcl index 42560c98d..fb143914f 100644 --- a/builds/linux/centos-linux-8/linux-centos-linux.pkr.hcl +++ b/builds/linux/centos-linux-8/linux-centos-linux.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: CentOS Linux 8 template using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -82,11 +82,15 @@ source "vsphere-iso" "linux-centos-linux" { shutdown_timeout = var.common_shutdown_timeout // Communicator Settings and Credentials - communicator = "ssh" - ssh_username = var.build_username - ssh_password = var.build_password - ssh_port = var.communicator_port - ssh_timeout = var.communicator_timeout + communicator = "ssh" + ssh_proxy_host = var.communicator_proxy_host + ssh_proxy_port = var.communicator_proxy_port + ssh_proxy_username = var.communicator_proxy_username + ssh_proxy_password = var.communicator_proxy_password + ssh_username = var.build_username + ssh_password = var.build_password + ssh_port = var.communicator_port + ssh_timeout = var.communicator_timeout // Template and Content Library Settings convert_to_template = var.common_template_conversion diff --git a/builds/linux/centos-linux-8/variables.pkr.hcl b/builds/linux/centos-linux-8/variables.pkr.hcl index df4c61b6f..d15224990 100644 --- a/builds/linux/centos-linux-8/variables.pkr.hcl +++ b/builds/linux/centos-linux-8/variables.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: CentOS Linux 8 variables using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -293,6 +293,31 @@ variable "build_key" { sensitive = true } +variable "communicator_proxy_host" { + type = string + description = "A SOCKS proxy host to use for SSH connection." + default = null +} + +variable "communicator_proxy_port" { + type = number + description = "A port of the SOCKS proxy." + default = null +} + +variable "communicator_proxy_username" { + type = string + description = "The optional username to authenticate with the proxy server." + default = null +} + +variable "communicator_proxy_password" { + type = string + description = "The optional password to use to authenticate with the proxy server." + sensitive = true + default = null +} + variable "communicator_port" { type = string description = "The port for the communicator protocol." diff --git a/builds/linux/centos-stream-8/linux-centos-stream.pkr.hcl b/builds/linux/centos-stream-8/linux-centos-stream.pkr.hcl index b44abbc3e..424c45b20 100644 --- a/builds/linux/centos-stream-8/linux-centos-stream.pkr.hcl +++ b/builds/linux/centos-stream-8/linux-centos-stream.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: CentOS Stream 8 template using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -82,11 +82,15 @@ source "vsphere-iso" "linux-centos-stream" { shutdown_timeout = var.common_shutdown_timeout // Communicator Settings and Credentials - communicator = "ssh" - ssh_username = var.build_username - ssh_password = var.build_password - ssh_port = var.communicator_port - ssh_timeout = var.communicator_timeout + communicator = "ssh" + ssh_proxy_host = var.communicator_proxy_host + ssh_proxy_port = var.communicator_proxy_port + ssh_proxy_username = var.communicator_proxy_username + ssh_proxy_password = var.communicator_proxy_password + ssh_username = var.build_username + ssh_password = var.build_password + ssh_port = var.communicator_port + ssh_timeout = var.communicator_timeout // Template and Content Library Settings convert_to_template = var.common_template_conversion diff --git a/builds/linux/centos-stream-8/variables.pkr.hcl b/builds/linux/centos-stream-8/variables.pkr.hcl index 98a6f4c49..f9f39e180 100644 --- a/builds/linux/centos-stream-8/variables.pkr.hcl +++ b/builds/linux/centos-stream-8/variables.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: CentOS Stream 8 variables using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -293,6 +293,31 @@ variable "build_key" { sensitive = true } +variable "communicator_proxy_host" { + type = string + description = "A SOCKS proxy host to use for SSH connection." + default = null +} + +variable "communicator_proxy_port" { + type = number + description = "A port of the SOCKS proxy." + default = null +} + +variable "communicator_proxy_username" { + type = string + description = "The optional username to authenticate with the proxy server." + default = null +} + +variable "communicator_proxy_password" { + type = string + description = "The optional password to use to authenticate with the proxy server." + sensitive = true + default = null +} + variable "communicator_port" { type = string description = "The port for the communicator protocol." diff --git a/builds/linux/photon-4/linux-photon.pkr.hcl b/builds/linux/photon-4/linux-photon.pkr.hcl index 307501cc5..7aa095b64 100644 --- a/builds/linux/photon-4/linux-photon.pkr.hcl +++ b/builds/linux/photon-4/linux-photon.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: VMware Photon OS 4 template using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -83,11 +83,15 @@ source "vsphere-iso" "linux-photon" { shutdown_timeout = var.common_shutdown_timeout // Communicator Settings and Credentials - communicator = "ssh" - ssh_username = var.build_username - ssh_password = var.build_password - ssh_port = var.communicator_port - ssh_timeout = var.communicator_timeout + communicator = "ssh" + ssh_proxy_host = var.communicator_proxy_host + ssh_proxy_port = var.communicator_proxy_port + ssh_proxy_username = var.communicator_proxy_username + ssh_proxy_password = var.communicator_proxy_password + ssh_username = var.build_username + ssh_password = var.build_password + ssh_port = var.communicator_port + ssh_timeout = var.communicator_timeout // Template and Content Library Settings convert_to_template = var.common_template_conversion @@ -108,7 +112,7 @@ build { destination = "/tmp/root-ca.crt" source = "../../../certificates/root-ca.crt" } - + provisioner "shell" { execute_command = "echo '${var.build_password}' | {{.Vars}} sudo -E -S sh -eux '{{.Path}}'" environment_vars = [ diff --git a/builds/linux/photon-4/variables.pkr.hcl b/builds/linux/photon-4/variables.pkr.hcl index 59bed1388..396c3bd46 100644 --- a/builds/linux/photon-4/variables.pkr.hcl +++ b/builds/linux/photon-4/variables.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: VMware Photon OS 4 variables using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -275,6 +275,31 @@ variable "build_key" { sensitive = true } +variable "communicator_proxy_host" { + type = string + description = "A SOCKS proxy host to use for SSH connection." + default = null +} + +variable "communicator_proxy_port" { + type = number + description = "A port of the SOCKS proxy." + default = null +} + +variable "communicator_proxy_username" { + type = string + description = "The optional username to authenticate with the proxy server." + default = null +} + +variable "communicator_proxy_password" { + type = string + description = "The optional password to use to authenticate with the proxy server." + sensitive = true + default = null +} + variable "communicator_port" { type = string description = "The port for the communicator protocol." diff --git a/builds/linux/redhat-linux-8/linux-redhat-linux.pkr.hcl b/builds/linux/redhat-linux-8/linux-redhat-linux.pkr.hcl index 94532fe78..0449686be 100644 --- a/builds/linux/redhat-linux-8/linux-redhat-linux.pkr.hcl +++ b/builds/linux/redhat-linux-8/linux-redhat-linux.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: Red Hat Enterprise Linux 8 template using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -82,11 +82,15 @@ source "vsphere-iso" "linux-redhat-linux" { shutdown_timeout = var.common_shutdown_timeout // Communicator Settings and Credentials - communicator = "ssh" - ssh_username = var.build_username - ssh_password = var.build_password - ssh_port = var.communicator_port - ssh_timeout = var.communicator_timeout + communicator = "ssh" + ssh_proxy_host = var.communicator_proxy_host + ssh_proxy_port = var.communicator_proxy_port + ssh_proxy_username = var.communicator_proxy_username + ssh_proxy_password = var.communicator_proxy_password + ssh_username = var.build_username + ssh_password = var.build_password + ssh_port = var.communicator_port + ssh_timeout = var.communicator_timeout // Template and Content Library Settings convert_to_template = var.common_template_conversion diff --git a/builds/linux/redhat-linux-8/variables.pkr.hcl b/builds/linux/redhat-linux-8/variables.pkr.hcl index 30dda6cf1..62f27bd1e 100644 --- a/builds/linux/redhat-linux-8/variables.pkr.hcl +++ b/builds/linux/redhat-linux-8/variables.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: Red Hat Enterprise Linux 8 variables using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -307,6 +307,31 @@ variable "build_key" { sensitive = true } +variable "communicator_proxy_host" { + type = string + description = "A SOCKS proxy host to use for SSH connection." + default = null +} + +variable "communicator_proxy_port" { + type = number + description = "A port of the SOCKS proxy." + default = null +} + +variable "communicator_proxy_username" { + type = string + description = "The optional username to authenticate with the proxy server." + default = null +} + +variable "communicator_proxy_password" { + type = string + description = "The optional password to use to authenticate with the proxy server." + sensitive = true + default = null +} + variable "communicator_port" { type = string description = "The port for the communicator protocol." diff --git a/builds/linux/rocky-linux-8/linux-rocky-linux.pkr.hcl b/builds/linux/rocky-linux-8/linux-rocky-linux.pkr.hcl index 38cb99eab..513d35417 100644 --- a/builds/linux/rocky-linux-8/linux-rocky-linux.pkr.hcl +++ b/builds/linux/rocky-linux-8/linux-rocky-linux.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: Rocky Linux 8 template using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -82,11 +82,15 @@ source "vsphere-iso" "linux-rocky-linux" { shutdown_timeout = var.common_shutdown_timeout // Communicator Settings and Credentials - communicator = "ssh" - ssh_username = var.build_username - ssh_password = var.build_password - ssh_port = var.communicator_port - ssh_timeout = var.communicator_timeout + communicator = "ssh" + ssh_proxy_host = var.communicator_proxy_host + ssh_proxy_port = var.communicator_proxy_port + ssh_proxy_username = var.communicator_proxy_username + ssh_proxy_password = var.communicator_proxy_password + ssh_username = var.build_username + ssh_password = var.build_password + ssh_port = var.communicator_port + ssh_timeout = var.communicator_timeout // Template and Content Library Settings convert_to_template = var.common_template_conversion diff --git a/builds/linux/rocky-linux-8/variables.pkr.hcl b/builds/linux/rocky-linux-8/variables.pkr.hcl index d63648d20..83fd659a6 100644 --- a/builds/linux/rocky-linux-8/variables.pkr.hcl +++ b/builds/linux/rocky-linux-8/variables.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: Rocky Linux 8 variables using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -293,6 +293,31 @@ variable "build_key" { sensitive = true } +variable "communicator_proxy_host" { + type = string + description = "A SOCKS proxy host to use for SSH connection." + default = null +} + +variable "communicator_proxy_port" { + type = number + description = "A port of the SOCKS proxy." + default = null +} + +variable "communicator_proxy_username" { + type = string + description = "The optional username to authenticate with the proxy server." + default = null +} + +variable "communicator_proxy_password" { + type = string + description = "The optional password to use to authenticate with the proxy server." + sensitive = true + default = null +} + variable "communicator_port" { type = string description = "The port for the communicator protocol." diff --git a/builds/linux/ubuntu-server-18-04-lts/linux-ubuntu-server.pkr.hcl b/builds/linux/ubuntu-server-18-04-lts/linux-ubuntu-server.pkr.hcl index 489c77f94..d98d1e1c7 100644 --- a/builds/linux/ubuntu-server-18-04-lts/linux-ubuntu-server.pkr.hcl +++ b/builds/linux/ubuntu-server-18-04-lts/linux-ubuntu-server.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: Ubuntu Server 18.04 LTS template using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -95,11 +95,15 @@ source "vsphere-iso" "linux-ubuntu-server" { shutdown_timeout = var.common_shutdown_timeout // Communicator Settings and Credentials - communicator = "ssh" - ssh_username = var.build_username - ssh_password = var.build_password - ssh_port = var.communicator_port - ssh_timeout = var.communicator_timeout + communicator = "ssh" + ssh_proxy_host = var.communicator_proxy_host + ssh_proxy_port = var.communicator_proxy_port + ssh_proxy_username = var.communicator_proxy_username + ssh_proxy_password = var.communicator_proxy_password + ssh_username = var.build_username + ssh_password = var.build_password + ssh_port = var.communicator_port + ssh_timeout = var.communicator_timeout // Template and Content Library Settings convert_to_template = var.common_template_conversion diff --git a/builds/linux/ubuntu-server-18-04-lts/variables.pkr.hcl b/builds/linux/ubuntu-server-18-04-lts/variables.pkr.hcl index af7d59516..3d7a7efb9 100644 --- a/builds/linux/ubuntu-server-18-04-lts/variables.pkr.hcl +++ b/builds/linux/ubuntu-server-18-04-lts/variables.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: Ubuntu Server 18.04 LTS variables using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -293,6 +293,31 @@ variable "build_key" { sensitive = true } +variable "communicator_proxy_host" { + type = string + description = "A SOCKS proxy host to use for SSH connection." + default = null +} + +variable "communicator_proxy_port" { + type = number + description = "A port of the SOCKS proxy." + default = null +} + +variable "communicator_proxy_username" { + type = string + description = "The optional username to authenticate with the proxy server." + default = null +} + +variable "communicator_proxy_password" { + type = string + description = "The optional password to use to authenticate with the proxy server." + sensitive = true + default = null +} + variable "communicator_port" { type = string description = "The port for the communicator protocol." diff --git a/builds/linux/ubuntu-server-20-04-lts/linux-ubuntu-server.pkr.hcl b/builds/linux/ubuntu-server-20-04-lts/linux-ubuntu-server.pkr.hcl index f06ba7111..287b7b838 100644 --- a/builds/linux/ubuntu-server-20-04-lts/linux-ubuntu-server.pkr.hcl +++ b/builds/linux/ubuntu-server-20-04-lts/linux-ubuntu-server.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: Ubuntu Server 20.04 LTS template using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -83,11 +83,15 @@ source "vsphere-iso" "linux-ubuntu-server" { shutdown_timeout = var.common_shutdown_timeout // Communicator Settings and Credentials - communicator = "ssh" - ssh_username = var.build_username - ssh_password = var.build_password - ssh_port = var.communicator_port - ssh_timeout = var.communicator_timeout + communicator = "ssh" + ssh_proxy_host = var.communicator_proxy_host + ssh_proxy_port = var.communicator_proxy_port + ssh_proxy_username = var.communicator_proxy_username + ssh_proxy_password = var.communicator_proxy_password + ssh_username = var.build_username + ssh_password = var.build_password + ssh_port = var.communicator_port + ssh_timeout = var.communicator_timeout // Template and Content Library Settings convert_to_template = var.common_template_conversion diff --git a/builds/linux/ubuntu-server-20-04-lts/variables.pkr.hcl b/builds/linux/ubuntu-server-20-04-lts/variables.pkr.hcl index 36598b7a6..931f8bfe8 100644 --- a/builds/linux/ubuntu-server-20-04-lts/variables.pkr.hcl +++ b/builds/linux/ubuntu-server-20-04-lts/variables.pkr.hcl @@ -1,5 +1,5 @@ /* - DESCRIPTION: + DESCRIPTION: Ubuntu Server 20.04 LTS variables using the Packer Builder for VMware vSphere (vsphere-iso). */ @@ -293,6 +293,31 @@ variable "build_key" { sensitive = true } +variable "communicator_proxy_host" { + type = string + description = "A SOCKS proxy host to use for SSH connection." + default = null +} + +variable "communicator_proxy_port" { + type = number + description = "A port of the SOCKS proxy." + default = null +} + +variable "communicator_proxy_username" { + type = string + description = "The optional username to authenticate with the proxy server." + default = null +} + +variable "communicator_proxy_password" { + type = string + description = "The optional password to use to authenticate with the proxy server." + sensitive = true + default = null +} + variable "communicator_port" { type = string description = "The port for the communicator protocol." diff --git a/builds/proxy.pkrvars.hcl b/builds/proxy.pkrvars.hcl new file mode 100644 index 000000000..6edbb3ff1 --- /dev/null +++ b/builds/proxy.pkrvars.hcl @@ -0,0 +1,11 @@ +/* + DESCRIPTION: + Proxy variables used for Linux builds. (Optional) + - Variables are passed to and used by configuration scripts. +*/ + +// Proxy Credentials +// communicator_proxy_host = "proxy.rainpole.io" +// communicator_proxy_port = 1080 +// communicator_proxy_username = "rainpole" +// communicator_proxy_password = "R@in!$aG00dThing."