From patchwork Wed Feb 5 15:52:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13961410 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A17218DF65 for ; Wed, 5 Feb 2025 15:52:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738770778; cv=none; b=suz1DG1WROWd9v+xsg9tUyuaF6lxeeFrOnTmiL3XxYJNlXquLbEXbbq5M+4ZWV+1+4h8K68lz05I7iD1rujnm2OgBhE+MEww3aXkkA1qhEC8OBonVdc9R47EjFR7Hd1hcSSRh+s2Qr3DrSMXM8+PFAH/GnmIZwlAkeQ/2X6/IuY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738770778; c=relaxed/simple; bh=WIe3mIsg6XtVIVS1KPf4nxESUuwYEOkK6zK41qZSy7Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LLbKKZrNTHJi0J6vMwGLQ12OyQEBVlsl8R08WWkVU/jxzgv3lt9h02V1XKaDKix+2qmfATEhFL7d86b4GPT83kOdp2A6nWJdAyXeO4Lr4tdruXHSfPV8onm+HYMQePdgyEeYaPLzq/D1uNJSP1SFd0CTyxoVzpvqW630BMtCl4E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qeCU1PXw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qeCU1PXw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 367B0C4CEDD; Wed, 5 Feb 2025 15:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738770777; bh=WIe3mIsg6XtVIVS1KPf4nxESUuwYEOkK6zK41qZSy7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qeCU1PXwu3pl+hykItL4eAAA7hGIQnVqyS4899JeRGqHxBAWzs3YDM46aCC6Fw/JT S3O8/AgEYhTNC71T5CpGGg8BrKgiJHr5Fod0MHqH+BgchRbiSsaALgKy5j+7TS3mND CJt64HWeSflL6m4lOZ4wON75+nrAXDCYjvCuh6jvK9Qg+K6ktchIMqaEAaewRt3q6t aRWsu5guXAkgHb74Yxs2GpLXBCI5uwm1qHCJE8gokIn5HLQ6O7mBiAZ/v8S4ELEmPB FAs8A0MFbwd3/P2IzVAWkNNsc81A4rfo9GDX2mMVu+cuEPee5aA/WIvHItHGXqJ8cy cOHKjG7re9/Sg== From: cel@kernel.org To: Cc: Chuck Lever Subject: [PATCH v2 05/12] update_ssh_config: Add tags to steps Date: Wed, 5 Feb 2025 10:52:45 -0500 Message-ID: <20250205155252.1317763-6-cel@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250205155252.1317763-1-cel@kernel.org> References: <20250205155252.1317763-1-cel@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever I'm about to add new functions to the update_ssh_config role that can be run by specifying tags on the ansible-playbook command line. To run only the steps that update the controller's .ssh/config Include directive, add a "deps" tag. Signed-off-by: Chuck Lever --- playbooks/roles/update_ssh_config/tasks/main.yml | 8 ++++++++ scripts/ssh.Makefile | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/playbooks/roles/update_ssh_config/tasks/main.yml b/playbooks/roles/update_ssh_config/tasks/main.yml index 6a7b58d8a556..417781936f7f 100644 --- a/playbooks/roles/update_ssh_config/tasks/main.yml +++ b/playbooks/roles/update_ssh_config/tasks/main.yml @@ -1,10 +1,12 @@ --- - name: Check that the controller's ssh config file exists + tags: deps ansible.builtin.stat: path: "{{ sshconfig }}" register: ssh_config - name: Check that the kdevops Include directive is present + tags: deps ansible.builtin.lineinfile: path: "{{ sshconfig }}" regexp: "Include ~/.ssh/config_kdevops_*" @@ -15,6 +17,7 @@ when: ssh_config.stat.exists - name: Check that the Include directive has a kdevops_version comment + tags: deps ansible.builtin.lineinfile: path: "{{ sshconfig }}" regexp: "^#(.*)kdevops_version(.*)" @@ -27,6 +30,7 @@ # If both the include directive was found and kdevops version comment was found # we bail right away to avoid updating the ssh config file always. - name: Check if the new fixed include directive was used + tags: deps ansible.builtin.meta: end_play when: - ssh_config.stat.exists @@ -34,6 +38,7 @@ - fixed_ssh_entry.found - name: Remove the stale Include directive + tags: deps ansible.builtin.lineinfile: path: "{{ sshconfig }}" line: "Include ~/.ssh/config_kdevops_*" @@ -41,6 +46,7 @@ when: ssh_config.stat.exists - name: Remove stale kdevops comments + tags: deps ansible.builtin.lineinfile: path: "{{ sshconfig }}" regexp: "^#(.*)kdevops(.*)" @@ -48,6 +54,7 @@ when: ssh_config.stat.exists - name: Remove extraneous extra new lines + tags: deps ansible.builtin.replace: path: "{{ sshconfig }}" regexp: '(^\s*$)' @@ -56,6 +63,7 @@ # ssh include directives must follow a new line. - name: Add a proper Include directive to {{ sshconfig }} + tags: deps ansible.builtin.blockinfile: path: "{{ sshconfig }}" insertbefore: BOF diff --git a/scripts/ssh.Makefile b/scripts/ssh.Makefile index cf79a1dd6c27..caa4bc797c48 100644 --- a/scripts/ssh.Makefile +++ b/scripts/ssh.Makefile @@ -25,7 +25,7 @@ $(KDEVOPS_SSH_PRIVKEY): .config PHONY += update-ssh-config update-ssh-config: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \ - --inventory localhost, \ + --inventory localhost, --tags deps \ playbooks/update_ssh_config.yml \ --extra-vars=@./extra_vars.yaml \ -e 'ansible_python_interpreter=/usr/bin/python3'