From: Scott Mayhew <smayhew@redhat.com>
To: kdevops@lists.linux.dev
Subject: [PATCH 1/5] nfsd: make sure the appropriate fsprogs package is installed
Date: Thu, 7 Mar 2024 08:14:10 -0500 [thread overview]
Message-ID: <20240307131414.1244984-2-smayhew@redhat.com> (raw)
In-Reply-To: <20240307131414.1244984-1-smayhew@redhat.com>
The virt-builder images don't have all of the fsprogs packages installed
by default, so make sure to install whatever package is needed for the
filesystem being exported.
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
.../nfsd/tasks/install-deps/debian/main.yml | 28 ++++++++++++++---
.../nfsd/tasks/install-deps/redhat/main.yml | 31 ++++++++++++++-----
.../nfsd/tasks/install-deps/suse/main.yml | 27 +++++++++++++---
playbooks/roles/nfsd/vars/Debian.yml | 11 +++++++
playbooks/roles/nfsd/vars/RedHat.yml | 12 +++++++
playbooks/roles/nfsd/vars/Suse.yml | 10 ++++++
6 files changed, 102 insertions(+), 17 deletions(-)
create mode 100644 playbooks/roles/nfsd/vars/Debian.yml
create mode 100644 playbooks/roles/nfsd/vars/RedHat.yml
create mode 100644 playbooks/roles/nfsd/vars/Suse.yml
diff --git a/playbooks/roles/nfsd/tasks/install-deps/debian/main.yml b/playbooks/roles/nfsd/tasks/install-deps/debian/main.yml
index fd237e76..a48d40ef 100644
--- a/playbooks/roles/nfsd/tasks/install-deps/debian/main.yml
+++ b/playbooks/roles/nfsd/tasks/install-deps/debian/main.yml
@@ -1,13 +1,31 @@
---
+- name: Get OS-specific variables
+ ansible.builtin.include_vars: "{{ lookup('ansible.builtin.first_found', params) }}"
+ vars:
+ params:
+ files:
+ - '{{ansible_distribution}}.yml'
+ - '{{ansible_os_family}}.yml'
+ - default.yml
+ paths:
+ - 'vars'
+
+- name: Determine which fsprogs package is needed for "{{ nfsd_export_fstype }}"
+ set_fact:
+ fsprogs: "{{ fstype_userspace_progs[nfsd_export_fstype] | default() }}"
+
+- name: Add {{ fsprogs }} to the nfsd packages list
+ set_fact:
+ nfsd_packages: "{{ nfsd_packages + [fsprogs] }}"
+ when:
+ - fsprogs is defined
+ - fsprogs
+
- name: Install nfsd dependencies
become: yes
become_method: sudo
apt:
- name:
- - lvm2
- - nfs-common
- - nfs-kernel-server
- - policycoreutils
+ name: "{{ nfsd_packages }}"
state: present
update_cache: yes
tags: [ 'pynfs', 'deps' ]
diff --git a/playbooks/roles/nfsd/tasks/install-deps/redhat/main.yml b/playbooks/roles/nfsd/tasks/install-deps/redhat/main.yml
index 15e06a66..d5d25c20 100644
--- a/playbooks/roles/nfsd/tasks/install-deps/redhat/main.yml
+++ b/playbooks/roles/nfsd/tasks/install-deps/redhat/main.yml
@@ -1,18 +1,33 @@
---
+- name: Get OS-specific variables
+ ansible.builtin.include_vars: "{{ lookup('ansible.builtin.first_found', params) }}"
+ vars:
+ params:
+ files:
+ - '{{ansible_distribution}}.yml'
+ - '{{ansible_os_family}}.yml'
+ - default.yml
+ paths:
+ - 'vars'
+
+- name: Determine which fsprogs package is needed for "{{ nfsd_export_fstype }}"
+ set_fact:
+ fsprogs: "{{ fstype_userspace_progs[nfsd_export_fstype] | default() }}"
+
+- name: Add {{ fsprogs }} to the nfsd packages list
+ set_fact:
+ nfsd_packages: "{{ nfsd_packages + [fsprogs] }}"
+ when:
+ - fsprogs is defined
+ - fsprogs
+
- name: Install nfsd dependencies
become: yes
become_method: sudo
yum:
update_cache: yes
- name: "{{ packages }}"
+ name: "{{ nfsd_packages }}"
retries: 3
delay: 5
register: result
until: result.rc == 0
- vars:
- packages:
- - checkpolicy
- - lvm2
- - nfs-utils
- - policycoreutils
- - python3-policycoreutils
diff --git a/playbooks/roles/nfsd/tasks/install-deps/suse/main.yml b/playbooks/roles/nfsd/tasks/install-deps/suse/main.yml
index 8d84509a..49d931cd 100644
--- a/playbooks/roles/nfsd/tasks/install-deps/suse/main.yml
+++ b/playbooks/roles/nfsd/tasks/install-deps/suse/main.yml
@@ -1,10 +1,29 @@
---
+- name: Get OS-specific variables
+ ansible.builtin.include_vars: "{{ lookup('ansible.builtin.first_found', params) }}"
+ vars:
+ params:
+ files:
+ - '{{ansible_distribution}}.yml'
+ - '{{ansible_os_family}}.yml'
+ - default.yml
+ paths:
+ - 'vars'
+
+- name: Determine which fsprogs package is needed for "{{ nfsd_export_fstype }}"
+ set_fact:
+ fsprogs: "{{ fstype_userspace_progs[nfsd_export_fstype] | default() }}"
+
+- name: Add {{ fsprogs }} to the nfsd packages list
+ set_fact:
+ nfsd_packages: "{{ nfsd_packages + [fsprogs] }}"
+ when:
+ - fsprogs is defined
+ - fsprogs
+
- name: Install nfsd dependencies
become: yes
become_method: sudo
zypper:
- name:
- - lvm2
- - nfs-utils
- - policycoreutils
+ name: "{{ nfsd_packages }}"
state: present
diff --git a/playbooks/roles/nfsd/vars/Debian.yml b/playbooks/roles/nfsd/vars/Debian.yml
new file mode 100644
index 00000000..3bb9e810
--- /dev/null
+++ b/playbooks/roles/nfsd/vars/Debian.yml
@@ -0,0 +1,11 @@
+---
+nfsd_packages:
+ - lvm2
+ - nfs-common
+ - nfs-kernel-server
+ - policycoreutils
+
+fstype_userspace_progs:
+ btrfs: btrfs-progs
+ ext4: e2fsprogs
+ xfs: xfsprogs
diff --git a/playbooks/roles/nfsd/vars/RedHat.yml b/playbooks/roles/nfsd/vars/RedHat.yml
new file mode 100644
index 00000000..590818ca
--- /dev/null
+++ b/playbooks/roles/nfsd/vars/RedHat.yml
@@ -0,0 +1,12 @@
+---
+nfsd_packages:
+ - checkpolicy
+ - lvm2
+ - nfs-utils
+ - policycoreutils
+ - python3-policycoreutils
+
+fstype_userspace_progs:
+ btrfs: btrfs-progs
+ ext4: e2fsprogs
+ xfs: xfsprogs
diff --git a/playbooks/roles/nfsd/vars/Suse.yml b/playbooks/roles/nfsd/vars/Suse.yml
new file mode 100644
index 00000000..73b06c83
--- /dev/null
+++ b/playbooks/roles/nfsd/vars/Suse.yml
@@ -0,0 +1,10 @@
+---
+nfsd_packages:
+ - lvm2
+ - nfs-utils
+ - policycoreutils
+
+fstype_userspace_progs:
+ btrfs: btrfsprogs
+ ext4: e2fsprogs
+ xfs: xfsprogs
--
2.43.0
next prev parent reply other threads:[~2024-03-07 13:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 13:14 [PATCH 0/5] add initial support for testing nfs with krb5 Scott Mayhew
2024-03-07 13:14 ` Scott Mayhew [this message]
2024-03-07 13:14 ` [PATCH 2/5] update_etc_hosts: fix up hostnames on debian guestfs hosts Scott Mayhew
2024-03-07 13:14 ` [PATCH 3/5] nfsd: use EXTRA_VAR_INPUTS for export options Scott Mayhew
2024-03-07 13:14 ` [PATCH 4/5] devconfig: set /etc/hostname earlier Scott Mayhew
2024-03-07 13:14 ` [PATCH 5/5] fstests/nfs: add krb5 support Scott Mayhew
2024-03-08 16:57 ` Luis Chamberlain
2024-03-08 19:33 ` Scott Mayhew
2024-03-08 21:08 ` Scott Mayhew
2024-03-08 21:20 ` Luis Chamberlain
2024-03-08 21:18 ` Luis Chamberlain
2024-03-08 22:13 ` Scott Mayhew
2024-03-08 22:47 ` Luis Chamberlain
2024-03-08 15:01 ` [PATCH 0/5] add initial support for testing nfs with krb5 Chuck Lever III
2024-03-08 15:50 ` Scott Mayhew
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=20240307131414.1244984-2-smayhew@redhat.com \
--to=smayhew@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox