From patchwork Mon Jan 13 11:53:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Granados X-Patchwork-Id: 13937231 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 3BA261CAA9D for ; Mon, 13 Jan 2025 11:53:16 +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=1736769196; cv=none; b=tr/qxSr1WVU1vTGjVI19PGWrKLn80Jt4ZP3QqigVZp3a+JUPFC+/BD7SpYdrUAMqeyALRjONLVEvN2TdHKkOGP6A7aOsVSvCfeTifWR1IrBC1p98wDWqrP6lo6y6cuCSBOSFWB8HnTUdpSKH2U3/CVQbdEVkkUTUlI3B+hMpcE0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736769196; c=relaxed/simple; bh=FVJUFjxaM/R8fpk2NV9PoLz5rdhcjKBPNJtHwh5TkzY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sBmG3rvEJQyt7sUUPtnXnyXrbOpTzg16AetuLLyOXNhJvGYoVZ7JPvmFu1Lc7UYcNoUk16sVkIvP2fwZHuBvmTOhqUbElGRByiNqy9kFDYSspR5rFWOAaXMcpoGJpPY464yLUCt2E8+vsbLnHjAJSxXbIUiDu5M2zKm8CDSq5gk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aBwzjQh3; 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="aBwzjQh3" Received: by smtp.kernel.org (Postfix) with ESMTPS id D228EC4CEF1; Mon, 13 Jan 2025 11:53:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736769195; bh=FVJUFjxaM/R8fpk2NV9PoLz5rdhcjKBPNJtHwh5TkzY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aBwzjQh3VsCtP/8l+E6c4J+kFHJH4+CGxx9ST2foorA+PWFc0VPb/7pFICObmLr66 WlQC85TgcbleXyweRDfctevTjfOUhVKsPy3j8POt+KSuAwqNeDtblIwKPo8TmHMK2I hmWDyzWsG1oLP/U31MZGRnjro3qsk5Le9Ebtyjqz2wJl9+TMzxRsaGLfyX9AVDWJN3 FOqQQXLRtls5QTqG8y849yDqCiGQdkS8gBjoyhe0EEK2rNNq77MiEyf3LAySUZoMx6 k94wooLuAJ9xLgHgX1y0YGLBFUYc8Xv1Dh53xFzWT/mg19Tz/BgiwyMN7A4vI+IqXj 5MwCJpC361ZlA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA520E7719F; Mon, 13 Jan 2025 11:53:15 +0000 (UTC) From: Joel Granados Date: Mon, 13 Jan 2025 12:53:05 +0100 Subject: [PATCH RESEND 07/12] ansible: Run sudo by using the '-K' ansible arg Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250113-jag-bringup_fixes-v1-7-fb28030b1f26@kernel.org> References: <20250113-jag-bringup_fixes-v1-0-fb28030b1f26@kernel.org> In-Reply-To: <20250113-jag-bringup_fixes-v1-0-fb28030b1f26@kernel.org> To: kdevops@lists.linux.dev Cc: Joel Granados , mcgrof@kernel.org, da.gomez@samsung.com X-Mailer: b4 0.15-dev-00a43 X-Developer-Signature: v=1; a=openpgp-sha256; l=3240; i=joel.granados@kernel.org; h=from:subject:message-id; bh=FVJUFjxaM/R8fpk2NV9PoLz5rdhcjKBPNJtHwh5TkzY=; b=owJ4nAHtARL+kA0DAAoBupfNUreWQU8ByyZiAGeE/qbtjh6tlRNzC3rhNV22vS6dEpRScKjU+ QLoECBcRn7vAokBswQAAQoAHRYhBK5HCVcl5jElzssnkLqXzVK3lkFPBQJnhP6mAAoJELqXzVK3 lkFPoxkL/1wgbop1AiHixSqjBrHy/rURT+ip2Ub2wAJb/nmy5GApYHg8u/t4iTTgBMmDfI6AY1K B60nnMBffhw90zMoqSjMrH4jASh6+oR/bgWq55Ua8QNWwuoehAgjxWh7HAk6ytIVzq+GI3JAA5L rSEHD1UGTVS1sKdiFlis30YMYeIG3mKUAO0Vsic26RQsmIiY84Z+PF0EHLXRb4b9g1BFKpcjb+S 3/b56xwwR7VppNxypTV/N/SO+Z6M7nz14uUlEzpgfPMZmIY4bzHkOyOdq/sgDUUyMu3XJAxqLqK 7QHdD9Fzi46OlrhhRsqDDhwg8h6sWiL5MwdQ8INJ+TTvfs1gJ0KVJIyNgevl9skAcsdrPrME41t E1YmysPZpzpZ3+xe3zit1Dwi0tCKb9FM2wzR7bpp1/SpWhIPvwLsG45FuaBL2ukaT+uCjv55kP0 3IO5b/ql7XJHZcYYwCc/CWvHNwzMMiR6oNdCMcTFnZNoOM6j3PhUvq5T25ksGl1FAomsW94i1Q9 BU= X-Developer-Key: i=joel.granados@kernel.org; a=openpgp; fpr=F1F8E46D30F0F6C4A45FF4465895FAAC338C6E77 X-Endpoint-Received: by B4 Relay for joel.granados@kernel.org/default with auth_id=239 This patch does two things: * Remove the become_flags from sudo tasks in bringup_guestfs and libvirt_user roles * Call the playbook with the -K argument so the user enters the sudo password just once after the playbook call Signed-off-by: Joel Granados --- playbooks/roles/bringup_guestfs/tasks/main.yml | 6 ------ playbooks/roles/libvirt_user/tasks/enable-user/debian/main.yml | 1 - scripts/guestfs.Makefile | 2 +- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/playbooks/roles/bringup_guestfs/tasks/main.yml b/playbooks/roles/bringup_guestfs/tasks/main.yml index 07e0fc4..95631aa 100644 --- a/playbooks/roles/bringup_guestfs/tasks/main.yml +++ b/playbooks/roles/bringup_guestfs/tasks/main.yml @@ -59,7 +59,6 @@ - name: Check dnsmasq service status become: yes - become_flags: 'su - -c' become_method: sudo command: systemctl is-enabled dnsmasq register: dnsmasq_enabled @@ -72,7 +71,6 @@ - name: Check if dnsmasq service is active become: yes - become_flags: 'su - -c' become_method: sudo command: systemctl is-active dnsmasq register: dnsmasq_active @@ -94,7 +92,6 @@ - name: Check if libvirt default network is running become: yes - become_flags: 'su - -c' become_method: sudo shell: virsh net-list | grep -q default register: libvirt_default_net @@ -106,7 +103,6 @@ - name: Start the libvirt default network if not running command: virsh net-start default become: yes - become_flags: 'su - -c' become_method: sudo when: - 'libvirt_uri_system|bool' @@ -123,7 +119,6 @@ - name: Look for console.log files in guestfs subdirectories to check for CI enablement become: yes - become_flags: 'su - -c' become_method: sudo find: paths: "{{ topdir_path }}/guestfs" @@ -137,7 +132,6 @@ - name: Ensure console.log files are owned by the main user for CI monitoring become: yes - become_flags: 'su - -c' become_method: sudo file: path: "{{ item.path }}" diff --git a/playbooks/roles/libvirt_user/tasks/enable-user/debian/main.yml b/playbooks/roles/libvirt_user/tasks/enable-user/debian/main.yml index 5797bd6..2fa31ce 100644 --- a/playbooks/roles/libvirt_user/tasks/enable-user/debian/main.yml +++ b/playbooks/roles/libvirt_user/tasks/enable-user/debian/main.yml @@ -49,7 +49,6 @@ - name: Ensure our user is part of the libvirt/kvm groups tags: [ 'journal', 'build-deps' ] become: yes - become_flags: 'su - -c' become_method: sudo ansible.builtin.user: name: "{{ ansible_user_id }}" diff --git a/scripts/guestfs.Makefile b/scripts/guestfs.Makefile index dbfb372..480bc4f 100644 --- a/scripts/guestfs.Makefile +++ b/scripts/guestfs.Makefile @@ -73,7 +73,7 @@ $(KDEVOPS_PROVISIONED_SSH): $(Q)touch $(KDEVOPS_PROVISIONED_SSH) bringup_guestfs: $(GUESTFS_BRINGUP_DEPS) - $(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \ + $(Q)ansible-playbook -K $(ANSIBLE_VERBOSE) --connection=local \ --inventory localhost, \ playbooks/bringup_guestfs.yml \ -e 'ansible_python_interpreter=/usr/bin/python3' \