From: cel@kernel.org
To: <kdevops@lists.linux.dev>
Cc: Chuck Lever <chuck.lever@oracle.com>
Subject: [PATCH v2 02/12] update_ssh_config: Use {{ sshconfig }} instead of raw path
Date: Wed, 5 Feb 2025 10:52:42 -0500 [thread overview]
Message-ID: <20250205155252.1317763-3-cel@kernel.org> (raw)
In-Reply-To: <20250205155252.1317763-1-cel@kernel.org>
From: Chuck Lever <chuck.lever@oracle.com>
The sshconfig variable is set by Kconfig. The update_ssh_config role
needs to follow that setting, but was using a fixed "~/.ssh/config"
string instead.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
.../roles/update_ssh_config/tasks/main.yml | 23 ++++++++-----------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/playbooks/roles/update_ssh_config/tasks/main.yml b/playbooks/roles/update_ssh_config/tasks/main.yml
index 98c86f164612..01fac9fbb69e 100644
--- a/playbooks/roles/update_ssh_config/tasks/main.yml
+++ b/playbooks/roles/update_ssh_config/tasks/main.yml
@@ -1,12 +1,12 @@
-- name: Check if the ssh config file exists
+- name: Check that the controller's ssh config file exists
stat:
- path: "~/.ssh/config"
+ path: "{{ sshconfig }}"
register: ssh_config
# Check if the include directive is already presetn
- name: Check if the kdevops include directive was used
lineinfile:
- path: ~/.ssh/config
+ path: "{{ sshconfig }}"
regexp: "Include ~/.ssh/config_kdevops_*"
state: absent
check_mode: yes
@@ -17,7 +17,7 @@
# Check if the the kdevops_version was added in a comment
- name: Check if the new include directive was used with a kdevops_version comment
lineinfile:
- path: ~/.ssh/config
+ path: "{{ sshconfig }}"
regexp: "^#(.*)kdevops_version(.*)"
state: absent
check_mode: yes
@@ -34,34 +34,31 @@
- kdevops_ssh_include.found
- fixed_ssh_entry.found
-# If we're still running it means the correct include directive following a new
-# line was not found. So remove old stale include directives which may be
-# buggy.
-- name: Remove buggy stale include directive to ~/.ssh/config without a new line
+- name: Remove the stale Include directive
lineinfile:
- path: ~/.ssh/config
+ path: "{{ sshconfig }}"
line: "Include ~/.ssh/config_kdevops_*"
state: absent
when: ssh_config.stat.exists
- name: Remove any stale kdevops comments
lineinfile:
- path: ~/.ssh/config
+ path: "{{ sshconfig }}"
regexp: "^#(.*)kdevops(.*)"
state: absent
when: ssh_config.stat.exists
- name: Remove any extra new lines
replace:
- path: ~/.ssh/config
+ path: "{{ sshconfig }}"
regexp: '(^\s*$)'
replace: ''
when: ssh_config.stat.exists
# ssh include directives must follow a new line.
-- name: Add Include directive to ~/.ssh/config
+- name: Add a proper Include directive to {{ sshconfig }}
blockinfile:
- path: ~/.ssh/config
+ path: "{{ sshconfig }}"
insertbefore: BOF
marker: "{mark}"
marker_begin: "# Automatically added by kdevops\n# kdevops_version: {{ kdevops_version }}"
--
2.48.1
next prev parent reply other threads:[~2025-02-05 15:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-05 15:52 [PATCH v2 00/12] Replace terraform update_ssh_config module cel
2025-02-05 15:52 ` [PATCH v2 01/12] guestfs: Rename the update_ssh_config_guestfs role cel
2025-02-05 15:52 ` cel [this message]
2025-02-05 15:52 ` [PATCH v2 03/12] update_ssh_config: Fix ansible-lint nits cel
2025-02-05 15:52 ` [PATCH v2 04/12] update_ssh_config: Run update_ssh_config during "make deps" cel
2025-02-05 15:52 ` [PATCH v2 05/12] update_ssh_config: Add tags to steps cel
2025-02-05 15:52 ` [PATCH v2 06/12] ssh.Makefile: Generate an sshdir variable cel
2025-02-05 15:52 ` [PATCH v2 07/12] update_ssh_config: make Include directive follow ssh config directory cel
2025-02-06 19:58 ` Chuck Lever
2025-02-05 15:52 ` [PATCH v2 08/12] ssh.Makefile: Define a kdevops_ssh_config variable cel
2025-02-05 17:42 ` Luis Chamberlain
2025-02-06 2:36 ` Chuck Lever
2025-02-05 15:52 ` [PATCH v2 09/12] update_ssh_config: Add always-run ssh clean-up steps cel
2025-02-05 15:52 ` [PATCH v2 10/12] terraform: Add ssh hosts to ~/.ssh/config_kdevops_{{ sha1sum }} cel
2025-02-05 15:52 ` [PATCH v2 11/12] terraform: "make mrproper" should remove terraform/*/.terraform cel
2025-02-05 15:52 ` [PATCH v2 12/12] terraform: Remove the terrraform update_ssh_config module cel
2025-02-05 17:44 ` [PATCH v2 00/12] Replace terraform " Luis Chamberlain
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=20250205155252.1317763-3-cel@kernel.org \
--to=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.