Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
47 changes: 38 additions & 9 deletions linux/storage/mount.sls
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand Down
3 changes: 3 additions & 0 deletions linux/system/user.sls
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}:
Expand Down