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 972D4275844 for ; Fri, 30 May 2025 17:52:37 +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=1748627557; cv=none; b=N8uUiyu+tSiyRp+5jMYw4iUYBBPKiQYwaSTFnQxdKWJQWRV/hA/pv0ZTG3QMc+kaTVUdzeIEY/6iWSY+zH8ZILJaBeuvWZNEewtCaw1Vaf0P7lRVm3hgYvzc+a32r5ViiJ6NSvBVlkMNnZla6xDcax0cbd6M6QCbO0CFmeYbryc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748627557; c=relaxed/simple; bh=x76ethlMkLIp3p9inttwSk7uWnDiIikmYV9sG8yOoKk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GHOUYmMch7mKt3DvUO5PzLxRRPFiFmLImdgjL36EbPJgQvRR5KUynHoBZtSLwAPKahAF6I9GEPjgW7+rXT53BVSbgO7UY65IOc9Rqmjbmm7+2FsizIrgwf9dyfC4ILsRWgaKlIjvYnGNdQp95yNQc7ZI2ld6TEQeg1ZxZ2jfH0U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gebPZbKq; 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="gebPZbKq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2312EC4CEEB; Fri, 30 May 2025 17:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1748627557; bh=x76ethlMkLIp3p9inttwSk7uWnDiIikmYV9sG8yOoKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gebPZbKqPpMq9S4QzIaERDQgkAOYyBI+o11n6tqajPuiM+LDL0DU8BVgLxNQvl1bL +XQrvWGITfydF9QNytiyFBnda5lZx/M8lYH9oK2FnDCTgnlkiqowo8s9hXPibZ9Xh7 2M4KF9BEN6IT/dE/H/JVcCPY2pXfKmVezCyJrPIS++ujGLb5+/agNeVNwdLutiffET lpFS8cX92tEnVUEjdiJYCwSjYnVlAyPf67G5MqHXZ5DYZxPuQS1YJuv5MlFu3bV1/o P8wurpFyqenFywtQlcZRJ5rXUktqFgssvdTTAmMMSVjk142CkyfWy7j9BG1fruhtUw elOhCXmR9EWkw== From: Chuck Lever To: Cc: Chuck Lever , Luis Chamberlain Subject: [PATCH v2 09/12] guestfs: Move console-related steps to guestfs role Date: Fri, 30 May 2025 13:52:26 -0400 Message-ID: <20250530175229.489925-10-cel@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250530175229.489925-1-cel@kernel.org> References: <20250530175229.489925-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 Copy these steps to the guestfs role because my plan is to remove the bringup_guestfs role eventually. Reviewed-by: Luis Chamberlain Signed-off-by: Chuck Lever --- .../tasks/bringup/console-permissions.yml | 31 +++++++++++++++++++ playbooks/roles/guestfs/tasks/main.yml | 10 ++++++ scripts/guestfs.Makefile | 5 --- 3 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 playbooks/roles/guestfs/tasks/bringup/console-permissions.yml diff --git a/playbooks/roles/guestfs/tasks/bringup/console-permissions.yml b/playbooks/roles/guestfs/tasks/bringup/console-permissions.yml new file mode 100644 index 000000000000..ad169a4eab31 --- /dev/null +++ b/playbooks/roles/guestfs/tasks/bringup/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 8201c8a4dcb2..0cc9dc43cbe8 100644 --- a/playbooks/roles/guestfs/tasks/main.yml +++ b/playbooks/roles/guestfs/tasks/main.yml @@ -50,6 +50,16 @@ ansible.builtin.import_tasks: file: "{{role_path }}/tasks/bringup/main.yml" +- name: Set up target node console permissions + delegate_to: localhost + run_once: true + tags: + - bringup + ansible.builtin.import_tasks: + file: "{{ role_path }}/tasks/bringup/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 0f0a8b858dba..ebd7f53d1bde 100644 --- a/scripts/guestfs.Makefile +++ b/scripts/guestfs.Makefile @@ -79,11 +79,6 @@ bringup_guestfs: $(GUESTFS_BRINGUP_DEPS) -i hosts playbooks/guestfs.yml \ --extra-vars=@./extra_vars.yaml \ --tags bringup - $(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \ - --inventory localhost, \ - playbooks/bringup_guestfs.yml \ - --extra-vars=@./extra_vars.yaml \ - --tags console-permissions PHONY += bringup_guestfs status_guestfs: -- 2.49.0