From: cel@kernel.org
To: <kdevops@lists.linux.dev>
Cc: Chuck Lever <chuck.lever@oracle.com>
Subject: [RFC PATCH 2/5] Move the guestfs install-deps to the guestfs playbook
Date: Thu, 22 May 2025 09:31:34 -0400 [thread overview]
Message-ID: <20250522133137.989457-3-cel@kernel.org> (raw)
In-Reply-To: <20250522133137.989457-1-cel@kernel.org>
From: Chuck Lever <chuck.lever@oracle.com>
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 <chuck.lever@oracle.com>
---
.../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
next prev parent reply other threads:[~2025-05-22 13:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-22 13:31 [RFC PATCH 0/5] Convert bringup_guestfs to a single Ansible role cel
2025-05-22 13:31 ` [RFC PATCH 1/5] guestfs: Replace scripts/destroy_guestfs.sh with an Ansible playbook cel
2025-05-22 17:02 ` Luis Chamberlain
2025-05-22 17:03 ` Chuck Lever
2025-05-22 13:31 ` cel [this message]
2025-05-22 17:07 ` [RFC PATCH 2/5] Move the guestfs install-deps to the guestfs playbook Luis Chamberlain
2025-05-22 17:13 ` Chuck Lever
2025-05-22 17:16 ` Luis Chamberlain
2025-05-22 13:31 ` [RFC PATCH 3/5] guestfs: Move console-related steps to guestfs role cel
2025-05-22 17:09 ` Luis Chamberlain
2025-05-22 17:11 ` Chuck Lever
2025-05-22 17:15 ` Luis Chamberlain
2025-05-22 13:31 ` [RFC PATCH 4/5] guestfs: Move check-config, network, and storage-pool tags cel
2025-05-22 13:31 ` [RFC PATCH 5/5] guestfs: Convert part of scripts/bringup_guestfs.sh to Ansible cel
2025-05-22 17:14 ` Luis Chamberlain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250522133137.989457-3-cel@kernel.org \
--to=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=kdevops@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.