File tree Expand file tree Collapse file tree 12 files changed +105
-58
lines changed
Expand file tree Collapse file tree 12 files changed +105
-58
lines changed Original file line number Diff line number Diff line change @@ -67,14 +67,14 @@ config NFSD_LEASE_TIME
6767 complete faster.
6868
6969choice
70- prompt "Local or external physical storage "
70+ prompt "Persistent storage for exported file systems "
7171 default NFSD_EXPORT_STORAGE_LOCAL
7272
7373config NFSD_EXPORT_STORAGE_LOCAL
7474 bool "Local"
7575 help
76- Exported file systems will reside on physical storage
77- local to the NFS server itself.
76+ Exported file systems will reside on block devices local
77+ to the NFS server itself.
7878
7979config NFSD_EXPORT_STORAGE_ISCSI
8080 bool "iSCSI"
Original file line number Diff line number Diff line change 1818 name : " {{ iscsi_target_packages }}"
1919 state : present
2020
21- - name : Initialize the list of local physical volumes
22- ansible.builtin.set_fact :
23- iscsi_lvm_pvs : []
24-
25- - name : Expand the list of local physical volumes
26- ansible.builtin.set_fact :
27- iscsi_lvm_pvs : " {{ iscsi_lvm_pvs + [iscsi_target_pv_prefix + item | string] }}"
28- with_items : " {{ range(1, iscsi_target_pv_count + 1) }}"
29- loop_control :
30- label : " Adding {{ iscsi_target_pv_prefix + item | string }} ..."
31-
32- - name : Create LVM volume group {{ iscsi_target_vg_name }}
33- become : true
34- become_flags : ' su - -c'
35- become_method : ansible.builtin.sudo
36- community.general.lvg :
37- vg : " {{ iscsi_target_vg_name }}"
38- pvs : " {{ iscsi_lvm_pvs | join(',') }}"
21+ - name : Set up a volume group on local block devices
22+ ansible.builtin.include_role :
23+ name : volume_group
24+ vars :
25+ volume_group_name : " {{ iscsi_target_vg_name }}"
26+ volume_device_prefix : " {{ iscsi_target_pv_prefix }}"
27+ volume_device_count : " {{ iscsi_target_pv_count }}"
3928
4029- name : Create a directory for storing iSCSI persistent reservations
4130 become : true
Original file line number Diff line number Diff line change 11---
22iscsi_target_packages :
3- - lvm2
43 - targetcli-fb
54 - sg3_utils
Original file line number Diff line number Diff line change 11---
22iscsi_target_packages :
3- - lvm2
43 - targetcli
54 - sg3_utils
65
Original file line number Diff line number Diff line change 11---
22iscsi_target_packages :
3- - lvm2
43 - targetcli-fb
54 - sg3_utils
65
Original file line number Diff line number Diff line change 11# SPDX-License-Identifier GPL-2.0+
22---
33# Our sensible defaults for the nfsd role.
4- nfsd_lvm_pvs : []
54nfsd_export_device_prefix : " "
65nfsd_export_device_count : 0
76nfsd_export_label : " export"
Original file line number Diff line number Diff line change 3030 - nfsd_export_storage_iscsi|bool
3131 - nfsd_export_fstype != "tmpfs"
3232
33- - name : Build string of devices to use as PVs
34- set_fact :
35- nfsd_lvm_pvs : " {{ nfsd_lvm_pvs + [ nfsd_export_device_prefix + item|string ] }}"
36- with_items : " {{ range(1, nfsd_export_device_count + 1) }}"
37- loop_control :
38- label : " Physical volume: {{ nfsd_export_device_prefix + item|string }}"
39- when :
40- - nfsd_export_storage_local|bool
41-
42- - name : Create a new LVM VG
43- become : yes
44- become_flags : ' su - -c'
45- become_method : sudo
46- community.general.lvg :
47- vg : " exports"
48- pvs : " {{ nfsd_lvm_pvs | join(',') }}"
33+ - name : Set up a volume group on local block devices
34+ ansible.builtin.include_role :
35+ name : volume_group
36+ vars :
37+ volume_group_name : " exports"
38+ volume_device_prefix : " {{ nfsd_export_device_prefix }}"
39+ volume_device_count : " {{ nfsd_export_device_count }}"
4940 when :
5041 - nfsd_export_storage_local|bool
5142 - nfsd_export_fstype != "tmpfs"
Original file line number Diff line number Diff line change 11---
2- smbd_lvm_pvs : []
32smbd_share_device_prefix : " "
43smbd_share_device_count : 0
54smbd_share_label : " share"
Original file line number Diff line number Diff line change 2222 group : root
2323 mode : 0644
2424
25- - name : Build string of devices to use as PVs
26- set_fact :
27- smbd_lvm_pvs : " {{ smbd_lvm_pvs + [ smbd_share_device_prefix + item|string ] }}"
28- with_items : " {{ range(1, smbd_share_device_count + 1) }}"
29-
30- - name : Print the PV list
31- ansible.builtin.debug :
32- var : smbd_lvm_pvs
33-
34- - name : Create a new LVM VG
35- become : yes
36- become_flags : ' su - -c'
37- become_method : sudo
38- community.general.lvg :
39- vg : " shares"
40- pvs : " {{ smbd_lvm_pvs | join(',') }}"
25+ - name : Set up a volume group on local block devices
26+ ansbiel.builtin.include_role :
27+ name : volume_group
28+ var :
29+ volume_group_name : " shares"
30+ volume_device_prefix : " {{ smbd_share_device_prefix }}"
31+ volume_device_count : " {{ smbd_share_device_count }}"
4132
4233- name : Create {{ smbd_share_path }}
4334 become : yes
Original file line number Diff line number Diff line change 1+ volume_group
2+ ============
3+
4+ The volume_group playbook creates a logical volume group
5+ on a target node using unused block devices.
6+
7+ Requirements
8+ ------------
9+
10+ The ansible community.general collection must be installed on the
11+ control host.
12+
13+ Role Variables
14+ --------------
15+
16+ * volume_group_name: The name for new volume group (string)
17+ * volume_device_prefix: The pathname prefix for block devices to
18+ consider for the new volume group (string)
19+ * volume_device_count: The number of block devices to include in
20+ the new volume group (int)
21+
22+ Dependencies
23+ ------------
24+
25+ None.
26+
27+ Example Playbook
28+ ----------------
29+
30+ Below is an example playbook task:
31+
32+ ```
33+ - name: Create a volume group for NFSD exports
34+ ansible.builtin.include_role:
35+ name: volume_group
36+ vars:
37+ volume_group_name: "exports"
38+ volume_device_prefix: "/dev/disk/by-id/virtio*"
39+ volume_count: 3
40+ ```
41+
42+ For further examples refer to one of this role's users, the
43+ [ https://github.com/linux-kdevops/kdevops ] ( kdevops ) project.
44+
45+ License
46+ -------
47+
48+ copyleft-next-0.3.1
You can’t perform that action at this time.
0 commit comments