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 C4CB5262BE for ; Thu, 22 May 2025 13:31:40 +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=1747920700; cv=none; b=RAVP8QJI+NGiIqNLK1cStLxGo1L+AuBV1uGAd9IVZPKugzKBb24BBMsKsUEf/vx4R6ZesDR06FoPLvyYAH3Blf/4k5ivOxlQMDCiwSqklgSHBpxkKrH453NhSbVDjS/o7P1Otk77oUfefhv/MshGN42qyWHzrt59mp6zgeNl8gI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747920700; c=relaxed/simple; bh=peRpi7tvp1plhtSrBXVgsYEC+JMgZqxzR+rmyTDZFoM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PJLe9WuFbA4U9zDy0NJYl0qjK/O+wQVMG/IhSQo10S2GDbDoZMotm/pHSSKBGHFuBjB3h5p4fwQO84C9kImAmPt/FAWq6uWwZN7NkI90HJS0S6Nb/MdcZYch+dLfdC9tFst8VRvbBtxNvYU+tl0XtLKcN0AU9VMxb+KsrKU9uCM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AfDPDSi2; 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="AfDPDSi2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7305AC4CEEB; 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=1747920700; bh=peRpi7tvp1plhtSrBXVgsYEC+JMgZqxzR+rmyTDZFoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AfDPDSi2Zjfr//L9Ooej3WK/Say0ZUzslJqKrZr2dEFlqwlshgL5nc8x8ueLi0aFA KojLSGpT/77mfWkS3XtnPysS4QAKkiS3PWNYy+Xpcyb5kLeCrqh3g2jQsVjEd7BJ1Z 5nuzOsNsdd5lw1Tle/GBCjpgQwdBvDoT3WQeIUGZ6XjRnTzHgbsLcG3IihFvDLiStJ ZIFBcs0X2nxs2G3K/ZgvUKPckJnPr++mnfbwTZHPxbUXSLwbPiHVD8rPMWFZk98eYB IBWvSl9YgHINO0BrljDiO8ve3QmevZLpnWtT6ovis039jP66IInZbHXRhybJpXZlLX 6/yzNAtEELK6w== From: cel@kernel.org To: Cc: Chuck Lever Subject: [RFC PATCH 2/5] Move the guestfs install-deps to the guestfs playbook Date: Thu, 22 May 2025 09:31:34 -0400 Message-ID: <20250522133137.989457-3-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 In addition to copying the install-deps scripts, switch to using import_tasks, which has more dependable behavior and avoids the need to add a "tags:" keyword on each step. Signed-off-by: Chuck Lever --- .../tasks/install-deps/debian/main.yml | 10 +++++++++ .../roles/guestfs/tasks/install-deps/main.yml | 21 +++++++++++++++++++ .../tasks/install-deps/redhat/main.yml | 12 +++++++++++ .../guestfs/tasks/install-deps/suse/main.yml | 9 ++++++++ playbooks/roles/guestfs/tasks/main.yml | 6 ++++++ scripts/guestfs.Makefile | 4 ++-- 6 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 playbooks/roles/guestfs/tasks/install-deps/debian/main.yml create mode 100644 playbooks/roles/guestfs/tasks/install-deps/main.yml create mode 100644 playbooks/roles/guestfs/tasks/install-deps/redhat/main.yml create mode 100644 playbooks/roles/guestfs/tasks/install-deps/suse/main.yml diff --git a/playbooks/roles/guestfs/tasks/install-deps/debian/main.yml b/playbooks/roles/guestfs/tasks/install-deps/debian/main.yml new file mode 100644 index 000000000000..5935f752a493 --- /dev/null +++ b/playbooks/roles/guestfs/tasks/install-deps/debian/main.yml @@ -0,0 +1,10 @@ +--- +- name: Install guestfs dependencies for Debian + become: true + become_method: ansible.builtin.sudo + ansible.builtin.package: + update_cache: true + name: + - libguestfs-tools + - isc-dhcp-client + state: present diff --git a/playbooks/roles/guestfs/tasks/install-deps/main.yml b/playbooks/roles/guestfs/tasks/install-deps/main.yml new file mode 100644 index 000000000000..5cbc55dcb188 --- /dev/null +++ b/playbooks/roles/guestfs/tasks/install-deps/main.yml @@ -0,0 +1,21 @@ +--- +- name: Gathering facts + ansible.builtin.gather_facts: + +- name: Debian-specific setup + ansible.builtin.import_tasks: + file: debian/main.yml + when: + - ansible_os_family == "Debian" + +- name: SuSE-specific setup + ansible.builtin.import_tasks: + file: suse/main.yml + when: + - ansible_os_family == "Suse" + +- name: Red Hat-specific setup + ansible.builtin.import_tasks: + file: redhat/main.yml + when: + - ansible_os_family == "Redhat" diff --git a/playbooks/roles/guestfs/tasks/install-deps/redhat/main.yml b/playbooks/roles/guestfs/tasks/install-deps/redhat/main.yml new file mode 100644 index 000000000000..c28a16a07c7a --- /dev/null +++ b/playbooks/roles/guestfs/tasks/install-deps/redhat/main.yml @@ -0,0 +1,12 @@ +--- +- name: Install guestfs dependencies for Red Hat Enterprise + become: true + become_method: ansible.builtin.sudo + ansible.builtin.package: + update_cache: true + name: + - libguestfs-tools + - dhcpcd + state: present + when: + - ansible_distribution != "Fedora" diff --git a/playbooks/roles/guestfs/tasks/install-deps/suse/main.yml b/playbooks/roles/guestfs/tasks/install-deps/suse/main.yml new file mode 100644 index 000000000000..c1bf24354612 --- /dev/null +++ b/playbooks/roles/guestfs/tasks/install-deps/suse/main.yml @@ -0,0 +1,9 @@ +--- +- name: Install guestfs dependencies for Suse + become: true + become_method: ansible.builtin.sudo + ansible.builtin.package: + name: + - libguestfs-tools + - dhcpcd + state: present diff --git a/playbooks/roles/guestfs/tasks/main.yml b/playbooks/roles/guestfs/tasks/main.yml index 60d4ffd40a20..ba38a67c4baf 100644 --- a/playbooks/roles/guestfs/tasks/main.yml +++ b/playbooks/roles/guestfs/tasks/main.yml @@ -1,4 +1,10 @@ --- +- name: Install guestfs dependencies on the Ansible controller + tags: + - install-deps + ansible.builtin.import_tasks: + file: "{{role_path }}/tasks/install-deps/main.yml" + - name: Shut down and destroy each target node tags: - destroy diff --git a/scripts/guestfs.Makefile b/scripts/guestfs.Makefile index 5d355ec70f8c..4ad347544cf6 100644 --- a/scripts/guestfs.Makefile +++ b/scripts/guestfs.Makefile @@ -68,9 +68,9 @@ $(KDEVOPS_PROVISIONED_SSH): $(Q)touch $(KDEVOPS_PROVISIONED_SSH) install_libguestfs: - $(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 install-deps -- 2.49.0