public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] guestfs: add the Include directive to ~/.ssh/config
@ 2024-02-29 17:29 Jeff Layton
  0 siblings, 0 replies; only message in thread
From: Jeff Layton @ 2024-02-29 17:29 UTC (permalink / raw)
  To: kdevops

Add a new playbook that uses the lineinfile: ansible call to ensure that
~/.ssh/config has the proper "Include" line to pull in any
config_kdevops ssh files that live in the same directory.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 playbooks/roles/update_ssh_config_guestfs/tasks/main.yml | 6 ++++++
 playbooks/update_ssh_config_guestfs.yml                  | 4 ++++
 scripts/guestfs.Makefile                                 | 4 ++++
 3 files changed, 14 insertions(+)
 create mode 100644 playbooks/roles/update_ssh_config_guestfs/tasks/main.yml
 create mode 100644 playbooks/update_ssh_config_guestfs.yml

diff --git a/playbooks/roles/update_ssh_config_guestfs/tasks/main.yml b/playbooks/roles/update_ssh_config_guestfs/tasks/main.yml
new file mode 100644
index 000000000000..368f99418d40
--- /dev/null
+++ b/playbooks/roles/update_ssh_config_guestfs/tasks/main.yml
@@ -0,0 +1,6 @@
+- name: Add Include directive to ~/.ssh/config
+  lineinfile:
+    path: ~/.ssh/config
+    line: "Include ~/.ssh/config_kdevops_*"
+    insertbefore: "BOF"
+    create: true
diff --git a/playbooks/update_ssh_config_guestfs.yml b/playbooks/update_ssh_config_guestfs.yml
new file mode 100644
index 000000000000..346b90245637
--- /dev/null
+++ b/playbooks/update_ssh_config_guestfs.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+  roles:
+    - role: update_ssh_config_guestfs
diff --git a/scripts/guestfs.Makefile b/scripts/guestfs.Makefile
index 9df15ec46e5b..6328cfd58f68 100644
--- a/scripts/guestfs.Makefile
+++ b/scripts/guestfs.Makefile
@@ -63,6 +63,10 @@ libvirt_pcie_passthrough_permissions:
 
 $(KDEVOPS_PROVISIONED_SSH):
 	$(Q)if [[ "$(CONFIG_KDEVOPS_SSH_CONFIG_UPDATE)" == "y" ]]; then \
+		ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
+			--inventory localhost, \
+			playbooks/update_ssh_config_guestfs.yml \
+			-e 'ansible_python_interpreter=/usr/bin/python3' ;\
 		LIBVIRT_DEFAULT_URI=$(CONFIG_LIBVIRT_URI) $(TOPDIR)/scripts/update_ssh_config_guestfs.py; \
 	fi
 	$(Q)touch $(KDEVOPS_PROVISIONED_SSH)
-- 
2.43.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-29 17:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-29 17:29 [PATCH] guestfs: add the Include directive to ~/.ssh/config Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox