diff mbox series

[v3,2/6] ssh.Makefile: Define a kdevops_ssh_config variable

Message ID 20250224191215.637818-3-cel@kernel.org (mailing list archive)
State New
Headers show
Series Replace terraform update_ssh_config module | expand

Commit Message

Chuck Lever Feb. 24, 2025, 7:12 p.m. UTC
From: Chuck Lever <chuck.lever@oracle.com>

Ensure that all provisioning scripts use the same pathname for the
ssh config file that stores ssh entries for kdevops target nodes
(which I'm referring to as the "ephemeral ssh config file").

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 kconfigs/Kconfig.ssh | 19 ++++++++++++++++---
 scripts/ssh.Makefile | 10 +++++++++-
 2 files changed, 25 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/kconfigs/Kconfig.ssh b/kconfigs/Kconfig.ssh
index 66ab3ce6f6ea..3b85568e19b4 100644
--- a/kconfigs/Kconfig.ssh
+++ b/kconfigs/Kconfig.ssh
@@ -18,11 +18,24 @@  config KDEVOPS_SSH_CONFIG_UPDATE
 if KDEVOPS_SSH_CONFIG_UPDATE
 
 config KDEVOPS_SSH_CONFIG
-	string "The ssh configuration file to update for systems created"
+	string "The controller's ssh configuration file"
 	default "~/.ssh/config"
 	help
-	  The ssh configuration file we should update, for each of the systems
-	  created.
+	  The pathname of the Ansible controller's ssh configuration file.
+	  kdevops may add an Include directive to this file that refers to a
+	  separate file where target node ssh configuration is managed.
+
+config KDEVOPS_SSH_CONFIG_PREFIX
+	string "Pathname prefix to an Ansible-managed ssh config file"
+	output yaml
+	default "~/.ssh/config_kdevops_"
+	help
+	  The pathname of a file into which Ansible inserts ssh configuration
+	  information for the target nodes during the "make bringup" step. On
+	  "make destroy" this file is destroyed.
+
+	  This file is kept in the controller's .ssh directory by default,
+	  but can be moved to other locations if desired.
 
 config KDEVOPS_SSH_CONFIG_UPDATE_STRICT
 	bool "Use strict configuration settings when adding each host"
diff --git a/scripts/ssh.Makefile b/scripts/ssh.Makefile
index 3ee9437b1b4c..d18a03e094ee 100644
--- a/scripts/ssh.Makefile
+++ b/scripts/ssh.Makefile
@@ -8,8 +8,16 @@  endif
 
 ifeq (y,$(CONFIG_KDEVOPS_SSH_CONFIG_UPDATE))
 SSH_CONFIG_FILE:=$(subst ",,$(CONFIG_KDEVOPS_SSH_CONFIG))
-ANSIBLE_EXTRA_ARGS += sshconfig=$(CONFIG_KDEVOPS_SSH_CONFIG)
+ANSIBLE_EXTRA_ARGS += sshconfig=$(shell realpath $(SSH_CONFIG_FILE))
+
+ifeq (y,$(CONFIG_TOPDIR_PATH_HAS_SHA256SUM))
+SSH_CONFIG_SUFFIX:=$(CONFIG_TOPDIR_PATH_SHA256SUM)
+else
+SSH_CONFIG_SUFFIX:=$(CONFIG_KDEVOPS_HOST_PREFIX)
 endif
+ANSIBLE_EXTRA_ARGS += kdevops_ssh_config=$(shell scripts/append-makefile-vars.sh $(CONFIG_KDEVOPS_SSH_CONFIG_PREFIX) $(SSH_CONFIG_SUFFIX))
+
+endif # CONFIG_KDEVOPS_SSH_CONFIG_UPDATE
 
 PHONY += remove-ssh-key
 remove-ssh-key: