File tree Expand file tree Collapse file tree 3 files changed +63
-5
lines changed Expand file tree Collapse file tree 3 files changed +63
-5
lines changed Original file line number Diff line number Diff line change @@ -104,8 +104,33 @@ lvm::volume_groups:
104104 mountpath : /var/backups
105105 mountpath_require : true
106106` ` `
107-
108-
107+ or to just build the VG if it does not exists
108+ ` ` ` yaml
109+ ---
110+ lvm::volume_groups :
111+ myvg :
112+ createonly : true
113+ physical_volumes :
114+ /dev/sda2 :
115+ unless_vg : ' myvg'
116+ /dev/sda3 :
117+ unless_vg : ' myvg'
118+ logical_volumes :
119+ opt :
120+ size : 20G
121+ tmp :
122+ size : 1G
123+ usr :
124+ size : 3G
125+ var :
126+ size : 15G
127+ home :
128+ size : 5G
129+ backup :
130+ size : 5G
131+ mountpath : /var/backups
132+ mountpath_require : true
133+ ` ` `
109134
110135Except that in the latter case you cannot specify create options.
111136If you want to omit the file system type, but still specify the size of the
Original file line number Diff line number Diff line change 1+ # == Define: lvm::physical_volume
2+ #
3+ define lvm::physical_volume (
4+ $ensure = present ,
5+ $force = false ,
6+ $unless_vg = undef ,
7+ ) {
8+
9+ if ($name == undef ) {
10+ fail(" lvm::physical_volume \$ name can't be undefined" )
11+ }
12+
13+ physical_volume { $name:
14+ ensure => $ensure ,
15+ force => $force ,
16+ unless _vg => $unless_vg
17+ }
18+
19+ }
Original file line number Diff line number Diff line change 22#
33define lvm::volume_group (
44 $physical_volumes ,
5+ $createonly = false ,
56 $ensure = present ,
67 $logical_volumes = {},
78) {
1213 fail(" lvm::volume_group \$ name can't be undefined" )
1314 }
1415
15- physical_volume { $physical_volumes:
16- ensure => $ensure ,
17- } ->
16+ if is_hash($physical_volumes ) {
17+ create_resources(
18+ ' lvm::physical_volume' ,
19+ $physical_volumes ,
20+ {
21+ ensure => $ensure ,
22+ }
23+ )
24+ }
25+ else {
26+ physical_volume { $physical_volumes:
27+ ensure => $ensure ,
28+ }
29+ }
30+
1831
1932 volume_group { $name:
2033 ensure => $ensure ,
34+ createonly => $createonly ,
2135 physical_volumes => $physical_volumes ,
2236 }
2337
You can’t perform that action at this time.
0 commit comments