public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: kdevops@lists.linux.dev
Subject: [PATCH] guestfs: add the Include directive to ~/.ssh/config
Date: Thu, 29 Feb 2024 12:29:23 -0500	[thread overview]
Message-ID: <20240229172923.79056-1-jlayton@kernel.org> (raw)

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


                 reply	other threads:[~2024-02-29 17:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240229172923.79056-1-jlayton@kernel.org \
    --to=jlayton@kernel.org \
    --cc=kdevops@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox