From mboxrd@z Thu Jan 1 00:00:00 1970 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 B1EB1262BE for ; Thu, 22 May 2025 13:31:41 +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=1747920701; cv=none; b=aYDFSnZF6pD1zjaUfcAKztRRs0JchhPUPRLVU5MNBqiGIDCRi03nYgGyWF/v6GAKEH9w6+EFhUX0+UqcwPycDCLrbTIMdpTIZj1mDxmNofwb8CwNeDAKQ6vgYMK0AZ+wQH593ELTIfpGyPt0i9oLyq46qjP1eiuxFasojTrdg6c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747920701; c=relaxed/simple; bh=hWa2PFzpOCDgz+qi9e72D0R0wPHwLChIRmzwCJi2+w8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nL8RPx+Np3TzcNYpU6YhiWDiNJ9Ru/YgourtmcmJ+tP/t/E5xvh/8e72PDDa4II5ujIhHFgnKJ2rBpnel0oA87qWvzEwLxuV/UIu+NuMy4lSmmuRErADsBs4i+CXc8IFERqxcKHZeSBVftXZFV1mxlCOkaDYRvdQBwaQGTBrtBg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iUYneS4B; 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="iUYneS4B" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDC72C4CEED; Thu, 22 May 2025 13:31:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747920701; bh=hWa2PFzpOCDgz+qi9e72D0R0wPHwLChIRmzwCJi2+w8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iUYneS4BL6/oB1A/IzY+CuwU5xnw87tCsLsTv0TuzhiBIM5Cb8JNNaz/sgx2RCCLD lGunwVEbzDeKHKz09VdXIdb02jccDRgDKArcUu5Vk3s3CFFsGaZj5NW1jxkL1w4/ML KMq8ZZbCk5BqPno1OGtMPYSwuHiZ2D2oa5ciyWZyeA8kcxr3BLn8TWC/tyljOxBSAw ZYLQkoke4jjhUtLbjpWc7FSfdHUDynaWdDkZVnOYWvgkoCfmFtb+kohM3dkwOzlDjz U5rZzwOhLwMkBsthxqJsqqPtoX8e4kyWQlRGDXqg2sOpKGLWPfve2AMWBdQFNFAJkI PvlVlRp3PBXug== From: cel@kernel.org To: Cc: Chuck Lever Subject: [RFC PATCH 3/5] guestfs: Move console-related steps to guestfs role Date: Thu, 22 May 2025 09:31:35 -0400 Message-ID: <20250522133137.989457-4-cel@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250522133137.989457-1-cel@kernel.org> References: <20250522133137.989457-1-cel@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Chuck Lever These steps are relocated because my plan is to remove the bringup_guestfs role eventually. Signed-off-by: Chuck Lever --- playbooks/roles/guestfs/defaults/main.yml | 3 ++ .../guestfs/tasks/console-permissions.yml | 31 +++++++++++++++++++ playbooks/roles/guestfs/tasks/main.yml | 8 +++++ scripts/guestfs.Makefile | 4 +-- 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 playbooks/roles/guestfs/defaults/main.yml create mode 100644 playbooks/roles/guestfs/tasks/console-permissions.yml diff --git a/playbooks/roles/guestfs/defaults/main.yml b/playbooks/roles/guestfs/defaults/main.yml new file mode 100644 index 000000000000..0d1e2ef82ae9 --- /dev/null +++ b/playbooks/roles/guestfs/defaults/main.yml @@ -0,0 +1,3 @@ +# SPDX-License-Identifier GPL-2.0+ +--- +libvirt_uri_system: false diff --git a/playbooks/roles/guestfs/tasks/console-permissions.yml b/playbooks/roles/guestfs/tasks/console-permissions.yml new file mode 100644 index 000000000000..ad169a4eab31 --- /dev/null +++ b/playbooks/roles/guestfs/tasks/console-permissions.yml @@ -0,0 +1,31 @@ +--- +- name: Get the user who invoked Ansible + ansible.builtin.command: + cmd: whoami + register: reg_user + changed_when: false + +- name: Look for console.log files in guestfs subdirectories to check for CI enablement + become: true + become_flags: 'su - -c' + become_method: ansible.builtin.sudo + ansible.builtin.find: + paths: "{{ topdir_path }}/guestfs" + patterns: "console.log" + file_type: file + recurse: true + register: console_log_files + +- name: Ensure console.log files are owned by the main user for CI monitoring + become: true + become_flags: 'su - -c' + become_method: ansible.builtin.sudo + ansible.builtin.file: + path: "{{ item.path }}" + owner: "{{ reg_user.stdout }}" + group: "{{ reg_user.stdout }}" + loop: "{{ console_log_files.files }}" + loop_control: + label: "{{ item.path | regex_replace('^.*guestfs/', 'guestfs/') }}" + when: + - console_log_files.matched > 0 diff --git a/playbooks/roles/guestfs/tasks/main.yml b/playbooks/roles/guestfs/tasks/main.yml index ba38a67c4baf..a469d48a082b 100644 --- a/playbooks/roles/guestfs/tasks/main.yml +++ b/playbooks/roles/guestfs/tasks/main.yml @@ -5,6 +5,14 @@ ansible.builtin.import_tasks: file: "{{role_path }}/tasks/install-deps/main.yml" +- name: Set up target node console permissions + tags: + - console-permissions + ansible.builtin.import_tasks: + file: "{{ role_path }}/tasks/console-permissions.yml" + when: + - libvirt_uri_system|bool + - name: Shut down and destroy each target node tags: - destroy diff --git a/scripts/guestfs.Makefile b/scripts/guestfs.Makefile index 4ad347544cf6..30bef9d17e99 100644 --- a/scripts/guestfs.Makefile +++ b/scripts/guestfs.Makefile @@ -81,9 +81,9 @@ bringup_guestfs: $(GUESTFS_BRINGUP_DEPS) --extra-vars=@./extra_vars.yaml \ --tags config-check,network,storage-pool-path $(Q)$(TOPDIR)/scripts/bringup_guestfs.sh - $(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \ + $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ --inventory localhost, \ - playbooks/bringup_guestfs.yml \ + playbooks/guestfs.yml \ --extra-vars=@./extra_vars.yaml \ --tags console-permissions PHONY += bringup_guestfs -- 2.49.0