From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 1BEA843ADE for ; Sat, 9 Mar 2024 23:36:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710027369; cv=none; b=tBGP02LQ9uvTBwRiAhfjrpwFtRU6xArGtL0FdsHnS7Jow0HXtrHVTgRRiOafMcDRUvfAaF2mJH5K0OyyY4z4uZSwYpOzKe6R8oINfOdohW35OqoHUaBHzBIxzoot7yVTUtuHjE9p7DQ9SabpwhSk5y13HAQcad2tVqdabfOK+jg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710027369; c=relaxed/simple; bh=nIbgGd3DI7BGXWSK4TBfC5PFeDPbxeIPjO55xS4W0ZQ=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=asCSETOANMAW8rkvtFqhC47cxYp3jXeW+zsBKQCCxLxeyMPIC0XMAt4wbfZlPmSmErW0o85g3p2wf32w5czQfKo4U3xjyDsRHo/paXwJTuPsCocTXHADugYwMoavEAbV1vgtApyZlArNdPjubtaVBnM1+JEGW+Sytvi88HwdZP8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=alfbEKf2; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="alfbEKf2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710027366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ff/vzoiuk2WuBS9z38eYbNOY/aPJAEFVcILTMxWCCd8=; b=alfbEKf2RwYm4r7FOybFAA3PKXUOZcmwrcVki2wJh9hCAZEFjUEn5LzfgNLTnw4Zynz4VI LDgtkeL6I3Q5J8z2gozgrbP661980AxPKG0xEHs/JOf4wWQ0x6sSbQLHC+1bftPq2jfeqP ASwTld+12JK64GK2J2qBWhTU+XUrqtI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-361-BJPkGVP9PLC3z1gn5kGTVw-1; Sat, 09 Mar 2024 18:36:04 -0500 X-MC-Unique: BJPkGVP9PLC3z1gn5kGTVw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3F470185A781 for ; Sat, 9 Mar 2024 23:36:04 +0000 (UTC) Received: from aion.redhat.com (unknown [10.22.16.116]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2C5BA17AA7 for ; Sat, 9 Mar 2024 23:36:04 +0000 (UTC) Received: from aion.redhat.com (localhost [IPv6:::1]) by aion.redhat.com (Postfix) with ESMTP id C4C9F12D1F8 for ; Sat, 9 Mar 2024 18:36:03 -0500 (EST) From: Scott Mayhew To: kdevops@lists.linux.dev Subject: [PATCH v2 01/10] nfsd: make sure the appropriate fsprogs package is installed Date: Sat, 9 Mar 2024 18:35:54 -0500 Message-ID: <20240309233603.1306533-2-smayhew@redhat.com> In-Reply-To: <20240309233603.1306533-1-smayhew@redhat.com> References: <20240309233603.1306533-1-smayhew@redhat.com> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 --- .../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