Skip to contentSkip to conversation

guestfs: add the Include directive to ~/.ssh/config

PATCH New Jeff Layton 1 participant 1 message Feb 29, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 guestfs: add the Include directive to ~/.ssh/config

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.

---
 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
playbooks/roles/update_ssh_config_guestfs/tasks/main.yml new file +6 -0
new file mode 100644
index 000000000000..368f99418d40
@@ -0,0 +1,6 @@
+- name: Add Include directive to ~/.ssh/config
+  lineinfile:
+    path: ~/.ssh/config
+    line: "Include ~/.ssh/config_kdevops_*"
+    insertbefore: "BOF"
+    create: true
playbooks/update_ssh_config_guestfs.yml new file +4 -0
new file mode 100644
index 000000000000..346b90245637
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+  roles:
+    - role: update_ssh_config_guestfs
scripts/guestfs.Makefile +4 -0
index 9df15ec46e5b..6328cfd58f68 100644
@@ -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)
Signature · 1 line
2.43.2