diff --git a/README.rst b/README.rst index a4d53236..f6efe0cf 100644 --- a/README.rst +++ b/README.rst @@ -1408,6 +1408,22 @@ LVM group `vg1` with one device and `data` volume mounted into `/mnt/data` size: 40G mount: ${linux:storage:mount:data} +Create File System during mount using lvm. For EXT and XFS there is ability to add block size. For XFS you must define if you want ``size`` or ``log``, so for size is ``block_size: size=2048``. + +.. code-block:: yaml + + parameters: + linux: + storage: + mount: + data: + enabled: true + device: /dev/vg1/data + file_system: ext4 + block_size: 2048 + path: /mnt/data + + Create partitions on disk. Specify size in MB. It expects empty disk without any existing partitions. diff --git a/linux/storage/mount.sls b/linux/storage/mount.sls index af77c260..af852da7 100644 --- a/linux/storage/mount.sls +++ b/linux/storage/mount.sls @@ -5,22 +5,51 @@ {%- if mount.enabled %} -{%- if not mount.file_system in ['nfs', 'nfs4', 'cifs', 'tmpfs'] %} +{%- if not mount.file_system in ['nfs', 'nfs4', 'cifs', 'tmpfs', 'none'] %} +{%- if mount.file_system == 'xfs' %} +create_xfs_{{ mount.device }}: + module.run: + - name: xfs.mkfs + - device: {{ mount.device }} + - label: {{ name }} +{%- if mount.block_size is defined %} + - bso: {{ mount.block_size }} +{%- endif %} + - onlyif: "test `blkid {{ mount.device }} >/dev/null;echo $?` -eq 2" + - require: + - pkg: xfs_packages_{{ mount.device }} + - require_in: + - mount: {{ mount.path }} + +xfs_packages_{{ mount.device }}: + pkg.installed: + - name: xfsprogs + +{%- elif mount.file_system in ['ext2', 'ext3', 'ext4'] %} +create_extfs_{{ mount.device }}: + module.run: + - name: extfs.mkfs + - device: {{ mount.device }} + - kwargs: { +{%- if mount.block_size is defined %} + block_size: {{ mount.block_size }}, +{%- endif %} + label: {{ name }} + } + - fs_type: {{ mount.file_system }} + - onlyif: "test `blkid {{ mount.device }} >/dev/null;echo $?` -eq 2" + - require_in: + - mount: {{ mount.path }} + +{%- else %} mkfs_{{ mount.device}}: cmd.run: - name: "mkfs.{{ mount.file_system }} -L {{ name }} {{ mount.device }}" - onlyif: "test `blkid {{ mount.device }} >/dev/null;echo $?` -eq 2" - require_in: - mount: {{ mount.path }} - {%- if mount.file_system == 'xfs' %} - - require: - - pkg: xfs_packages_{{ mount.device }} - -xfs_packages_{{ mount.device }}: - pkg.installed: - - name: xfsprogs - {%- endif %} +{%- endif %} {%- endif %} diff --git a/linux/system/user.sls b/linux/system/user.sls index fc640380..9bcd572c 100644 --- a/linux/system/user.sls +++ b/linux/system/user.sls @@ -41,6 +41,9 @@ system_user_{{ name }}: {%- if user.uid is defined and user.uid %} - uid: {{ user.uid }} {%- endif %} + {%- if user.gid is defined and user.gid %} + - gid: {{ user.gid }} + {%- endif %} - require: {{ requires|yaml }} system_user_home_{{ user.home }}: