From patchwork Wed Feb 5 15:52:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13961417 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 605451519BD for ; Wed, 5 Feb 2025 15:53:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738770781; cv=none; b=ahiONdObHQBGczJ2U8K/P/wgVn0uhNJdJt81ZkKDAq15OREey7JIepLYNaALKmK/t4z/rOfHa2N1ZhXT8W0RFX66CCEYlGYiul0ECKC2dHd1Us4mVQz+GcJPEapEtOD7SsaJQoJA5GBFS+fOckuBAITGCTs3pqQQoVr1rEyioyI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738770781; c=relaxed/simple; bh=jHUKaU0AdfJzo8XsSPRqJvewLRlfVX0zs71D3xqZ89Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jjhUnuEG25LGWEheXXT+GS92zuxUqojamb7xe7io+zipFQHfHTyR5XpPoPOmGmcqNWuhdhSNxVreoffftKUY9JKYJ+A11MiF86lWKzfsbFGpD+aFB7roM/rYkMSvCe4RzJHLRcy6RF5D5sH6AqkWWFU9IZdTP758BrfCo27fApo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=b9/dTZfp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="b9/dTZfp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8300C4CED6; Wed, 5 Feb 2025 15:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738770781; bh=jHUKaU0AdfJzo8XsSPRqJvewLRlfVX0zs71D3xqZ89Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b9/dTZfpwGkVwNut0AG/QmYhRU6wDAlSk5V2X2RBW5TcuwZ4tzS2iCLp0OEe3wi5t OmbY4DeirD76sn34CRnQNdoKe+CBNYn4h6MaS+MDJQzCM7IvTEfmad1y7+HcGXHehn vGAjOcET2kEZVysWiHKmB7nDLFN+d8cEZ7VJ5L5NMkEiyc8bbNOJ4p5OHwoPEuIsbY xj0HsEMRjTvi+j4ONsB8vgLiN76JyzRwed2Mka3nb3eeDAZFcduxdPBwTbwzvv08Qq Ki3GJsRNKZLdCCUVIrpoaCOVlJk+g7vnl96TJQ+CgjaEYlKOHgamKDtLoC2RSpVdjV LLudiOHzIcFeQ== From: cel@kernel.org To: Cc: Chuck Lever Subject: [PATCH v2 12/12] terraform: Remove the terrraform update_ssh_config module Date: Wed, 5 Feb 2025 10:52:52 -0500 Message-ID: <20250205155252.1317763-13-cel@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250205155252.1317763-1-cel@kernel.org> References: <20250205155252.1317763-1-cel@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever The add_ssh_hosts_terraform playbook has taken its place. XXX: Need to add a public_ip_map output for all cloud providers before removing the update_ssh_config terraform module. Signed-off-by: Chuck Lever --- terraform/aws/output.tf | 25 ---------------------- terraform/aws/update_ssh_config.tf | 1 - terraform/azure/output.tf | 18 ---------------- terraform/azure/update_ssh_config.tf | 1 - terraform/gce/output.tf | 27 +----------------------- terraform/gce/update_ssh_config.tf | 1 - terraform/oci/update_ssh_config.tf | 1 - terraform/openstack/output.tf | 2 ++ terraform/openstack/update_ssh_config.tf | 1 - terraform/update_ssh_config.tf | 17 --------------- 10 files changed, 3 insertions(+), 91 deletions(-) delete mode 120000 terraform/aws/update_ssh_config.tf delete mode 120000 terraform/azure/update_ssh_config.tf delete mode 120000 terraform/gce/update_ssh_config.tf delete mode 120000 terraform/oci/update_ssh_config.tf delete mode 120000 terraform/openstack/update_ssh_config.tf delete mode 100644 terraform/update_ssh_config.tf diff --git a/terraform/aws/output.tf b/terraform/aws/output.tf index cb8cab4afcdd..83a85a388055 100644 --- a/terraform/aws/output.tf +++ b/terraform/aws/output.tf @@ -1,30 +1,5 @@ # All generic output goes here -locals { - ssh_key_i = format( - " %s%s ", - var.ssh_config_pubkey_file != "" ? "-i " : "", - var.ssh_config_pubkey_file != "" ? replace(var.ssh_config_pubkey_file, ".pub", "") : "", - ) -} - -data "null_data_source" "group_hostnames_and_ips" { - count = local.kdevops_num_boxes - inputs = { - value = format( - "%30s : ssh %s@%s %s ", - element(var.kdevops_nodes, count.index), - var.ssh_config_user, - element(aws_eip.kdevops_eip.*.public_ip, count.index), - local.ssh_key_i, - ) - } -} - -output "login_using" { - value = data.null_data_source.group_hostnames_and_ips.*.outputs -} - # Each provider's output.tf needs to define a public_ip_map. This # map is used to build the Ansible controller's ssh configuration. # Each map entry contains the node's hostname and public IP address. diff --git a/terraform/aws/update_ssh_config.tf b/terraform/aws/update_ssh_config.tf deleted file mode 120000 index 03cd77a65841..000000000000 --- a/terraform/aws/update_ssh_config.tf +++ /dev/null @@ -1 +0,0 @@ -../update_ssh_config.tf \ No newline at end of file diff --git a/terraform/azure/output.tf b/terraform/azure/output.tf index a8e32b605a47..ce5ac79ff694 100644 --- a/terraform/azure/output.tf +++ b/terraform/azure/output.tf @@ -20,24 +20,6 @@ output "kdevops_public_ip_addresses" { value = data.azurerm_public_ip.public_ips.*.ip_address } -locals { - ssh_key_i = format(" %s%s ", var.ssh_config_pubkey_file != "" ? "-i " : "", var.ssh_config_pubkey_file != "" ? replace(var.ssh_config_pubkey_file, ".pub", "") : "") -} - -data "null_data_source" "group_hostnames_and_ips" { - count = local.kdevops_num_boxes - inputs = { - # In theory using "${self.triggers["name"]}" and "${self.triggersp["ip"]}" - # would be nice but it is not supported in this context, only in the - # provisioner and connection contexts. - value = "${format("%30s : ssh %s@%s %s ", element(azurerm_linux_virtual_machine.kdevops_vm.*.name, count.index), var.ssh_config_user, element(azurerm_public_ip.kdevops_publicip.*.ip_address, count.index), local.ssh_key_i)}" - } -} - -output "login_using" { - value = data.null_data_source.group_hostnames_and_ips.*.outputs -} - # Each provider's output.tf needs to define a public_ip_map. This # map is used to build the Ansible controller's ssh configuration. # Each map entry contains the node's hostname and public IP address. diff --git a/terraform/azure/update_ssh_config.tf b/terraform/azure/update_ssh_config.tf deleted file mode 120000 index 03cd77a65841..000000000000 --- a/terraform/azure/update_ssh_config.tf +++ /dev/null @@ -1 +0,0 @@ -../update_ssh_config.tf \ No newline at end of file diff --git a/terraform/gce/output.tf b/terraform/gce/output.tf index b95667cc7efd..470617f700ee 100644 --- a/terraform/gce/output.tf +++ b/terraform/gce/output.tf @@ -1,29 +1,4 @@ -locals { - ssh_key_i = format(" %s%s ", var.ssh_config_pubkey_file != "" ? "-i " : "", var.ssh_config_pubkey_file != "" ? replace(var.ssh_config_pubkey_file, ".pub", "") : "") - network_interfaces = google_compute_instance.kdevops_instances.*.network_interface - access_configs = [ - for net_interface in local.network_interfaces : - net_interface[0].access_config - ] - ipv4s = [ - for access_config in local.access_configs : - access_config[0].nat_ip - ] -} - -data "null_data_source" "group_hostnames_and_ips" { - count = local.kdevops_num_boxes - inputs = { - # In theory using "${self.triggers["name"]}" and "${self.triggersp["ip"]}" - # would be nice but it is not supported in this context, only in the - # provisioner and connection contexts. - value = "${format("%30s : ssh %s@%s %s ", element(google_compute_instance.kdevops_instances.*.name, count.index), var.ssh_config_user, element(local.ipv4s, count.index), local.ssh_key_i)}" - } -} - -output "login_using" { - value = data.null_data_source.group_hostnames_and_ips.*.outputs -} +# All generic output goes here # Each provider's output.tf needs to define a public_ip_map. This # map is used to build the Ansible controller's ssh configuration. diff --git a/terraform/gce/update_ssh_config.tf b/terraform/gce/update_ssh_config.tf deleted file mode 120000 index 03cd77a65841..000000000000 --- a/terraform/gce/update_ssh_config.tf +++ /dev/null @@ -1 +0,0 @@ -../update_ssh_config.tf \ No newline at end of file diff --git a/terraform/oci/update_ssh_config.tf b/terraform/oci/update_ssh_config.tf deleted file mode 120000 index 03cd77a65841..000000000000 --- a/terraform/oci/update_ssh_config.tf +++ /dev/null @@ -1 +0,0 @@ -../update_ssh_config.tf \ No newline at end of file diff --git a/terraform/openstack/output.tf b/terraform/openstack/output.tf index aff44d1b45f9..2d60cc46c030 100644 --- a/terraform/openstack/output.tf +++ b/terraform/openstack/output.tf @@ -1,3 +1,5 @@ +# All generic output goes here + data "null_data_source" "group_hostnames_and_ips" { count = local.kdevops_num_boxes inputs = { diff --git a/terraform/openstack/update_ssh_config.tf b/terraform/openstack/update_ssh_config.tf deleted file mode 120000 index 03cd77a65841..000000000000 --- a/terraform/openstack/update_ssh_config.tf +++ /dev/null @@ -1 +0,0 @@ -../update_ssh_config.tf \ No newline at end of file diff --git a/terraform/update_ssh_config.tf b/terraform/update_ssh_config.tf deleted file mode 100644 index 03f0cbed424a..000000000000 --- a/terraform/update_ssh_config.tf +++ /dev/null @@ -1,17 +0,0 @@ -module "ssh_config_update_host_entries" { - source = "linux-kdevops/add-host-ssh-config/kdevops" - version = "3.0.0" - - ssh_config = var.ssh_config - update_ssh_config_enable = var.ssh_config_update - cmd = "update" - shorthosts = join(",", slice(local.shorthosts, 0, local.kdevops_num_boxes)) - hostnames = join(",", slice(local.ipv4s, 0, local.kdevops_num_boxes)) - ports = "22" - user = var.ssh_config_user == "" ? "" : var.ssh_config_user - id = replace(var.ssh_config_pubkey_file, ".pub", "") - strict = var.ssh_config_use_strict_settings ? "true" : "" - use_backup = !var.ssh_config_backup || var.ssh_config == "/dev/null" ? "" : "true" - backup_postfix = "kdevops" - kexalgorithms = var.ssh_config_kexalgorithms == "" ? "" : var.ssh_config_kexalgorithms -}