From 6189c92b2f9d39c188675534a46bc85b6a4402ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Este-Gracias?= Date: Sat, 25 Sep 2021 23:00:31 +0200 Subject: [PATCH] Support ssh_proxy_* variables for Linux images (#40) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update README.md * Add proxy.pkrvars.hcl * Add proxy variables in Linux sources Signed-off-by: Stéphane Este-Gracias Co-authored-by: Ryan Johnson --- README.md | 68 ++++++++++++------- build.sh | 28 +++++--- .../linux/almalinux-8/linux-almalinux.pkr.hcl | 14 ++-- builds/linux/almalinux-8/variables.pkr.hcl | 25 +++++++ .../centos-linux-8/linux-centos-linux.pkr.hcl | 14 ++-- builds/linux/centos-linux-8/variables.pkr.hcl | 25 +++++++ .../linux-centos-stream.pkr.hcl | 14 ++-- .../linux/centos-stream-8/variables.pkr.hcl | 25 +++++++ builds/linux/photon-4/linux-photon.pkr.hcl | 14 ++-- builds/linux/photon-4/variables.pkr.hcl | 25 +++++++ .../redhat-linux-8/linux-redhat-linux.pkr.hcl | 14 ++-- builds/linux/redhat-linux-8/variables.pkr.hcl | 25 +++++++ .../rocky-linux-8/linux-rocky-linux.pkr.hcl | 14 ++-- builds/linux/rocky-linux-8/variables.pkr.hcl | 25 +++++++ .../linux-ubuntu-server.pkr.hcl | 14 ++-- .../ubuntu-server-18-04-lts/variables.pkr.hcl | 25 +++++++ .../linux-ubuntu-server.pkr.hcl | 14 ++-- .../ubuntu-server-20-04-lts/variables.pkr.hcl | 25 +++++++ builds/proxy.pkrvars.hcl | 11 +++ 19 files changed, 346 insertions(+), 73 deletions(-) create mode 100644 builds/proxy.pkrvars.hcl diff --git a/README.md b/README.md index 4b62688b2..6315cc6f2 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,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 @@ -255,27 +256,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: @@ -291,6 +286,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: @@ -309,6 +327,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="" @@ -317,14 +347,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 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 1f3c19c77..228eef6bb 100644 --- a/builds/linux/almalinux-8/linux-almalinux.pkr.hcl +++ b/builds/linux/almalinux-8/linux-almalinux.pkr.hcl @@ -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 495063c99..ba9973231 100644 --- a/builds/linux/almalinux-8/variables.pkr.hcl +++ b/builds/linux/almalinux-8/variables.pkr.hcl @@ -294,6 +294,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 31e0c42fa..89bf287b6 100644 --- a/builds/linux/centos-linux-8/linux-centos-linux.pkr.hcl +++ b/builds/linux/centos-linux-8/linux-centos-linux.pkr.hcl @@ -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 c33c256ec..4d481c196 100644 --- a/builds/linux/centos-linux-8/variables.pkr.hcl +++ b/builds/linux/centos-linux-8/variables.pkr.hcl @@ -294,6 +294,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 424b35406..189602aa3 100644 --- a/builds/linux/centos-stream-8/linux-centos-stream.pkr.hcl +++ b/builds/linux/centos-stream-8/linux-centos-stream.pkr.hcl @@ -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 93499ebc9..34a55af85 100644 --- a/builds/linux/centos-stream-8/variables.pkr.hcl +++ b/builds/linux/centos-stream-8/variables.pkr.hcl @@ -294,6 +294,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 43432be69..d25520b25 100644 --- a/builds/linux/photon-4/linux-photon.pkr.hcl +++ b/builds/linux/photon-4/linux-photon.pkr.hcl @@ -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 diff --git a/builds/linux/photon-4/variables.pkr.hcl b/builds/linux/photon-4/variables.pkr.hcl index 8dcbaea21..103096a03 100644 --- a/builds/linux/photon-4/variables.pkr.hcl +++ b/builds/linux/photon-4/variables.pkr.hcl @@ -276,6 +276,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 c373056e4..e245ae5f5 100644 --- a/builds/linux/redhat-linux-8/linux-redhat-linux.pkr.hcl +++ b/builds/linux/redhat-linux-8/linux-redhat-linux.pkr.hcl @@ -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 407114382..3e56ff507 100644 --- a/builds/linux/redhat-linux-8/variables.pkr.hcl +++ b/builds/linux/redhat-linux-8/variables.pkr.hcl @@ -308,6 +308,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 82b1ce7ab..dcc1d8228 100644 --- a/builds/linux/rocky-linux-8/linux-rocky-linux.pkr.hcl +++ b/builds/linux/rocky-linux-8/linux-rocky-linux.pkr.hcl @@ -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 b4080a32d..54d054bbc 100644 --- a/builds/linux/rocky-linux-8/variables.pkr.hcl +++ b/builds/linux/rocky-linux-8/variables.pkr.hcl @@ -294,6 +294,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 1a847107b..c75f383c8 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 @@ -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 fbe820148..6fa8cd8f8 100644 --- a/builds/linux/ubuntu-server-18-04-lts/variables.pkr.hcl +++ b/builds/linux/ubuntu-server-18-04-lts/variables.pkr.hcl @@ -294,6 +294,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 d51817cf3..0eadd55e5 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 @@ -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 2afa11991..624beeee7 100644 --- a/builds/linux/ubuntu-server-20-04-lts/variables.pkr.hcl +++ b/builds/linux/ubuntu-server-20-04-lts/variables.pkr.hcl @@ -294,6 +294,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."