Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.
/ ansible-disk Public archive
forked from AerisCloud/ansible-disk

Format extra disks and attach them to different mount points.

License

Notifications You must be signed in to change notification settings

gortc/ansible-disk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Disk

This role allows you to format extra disks and attach them to different mount points.

You can use it to move the data of different services to another disk.

Configuration

Inventory

Because the configuration for additional disks must be stored using the YAML syntax, you have to write it in a group_vars directory.

# inventory/group_vars/GROUP_NAME
disk_additional_disks:
 - disk: /dev/sdb
   fstype: ext4
   mount_options: defaults
   mount: /data
   user: www-data
   group: www-data
   disable_periodic_fsck: false
 - disk: /dev/nvme0n1
   part: /dev/nvme0n1p1
   fstype: xfs
   mount_options: defaults,noatime
   mount: /data2
  • disk is the device, you want to mount.
  • part is the first partition name. If not specified, 1 will be appended to the disk name.
  • fstype allows you to choose the filesystem to use with the new disk.
  • mount_options allows you to specify custom mount options.
  • mount is the directory where the new disk should be mounted.
  • user sets owner of the mount directory (default: root).
  • group sets group of the mount directory (default: root).
  • disable_periodic_fsck deactivates the periodic ext3/4 filesystem check for the new disk.

You can add:

  • disk_package_use is the required package manager module to use (yum, apt, etc). The default 'auto' will use existing facts or try to autodetect it.

The following filesystems are currently supported:

*) Note: To use these filesystems you have to define and install additional software packages. Please estimate the right package names for your operating system.

# inventory/group_vars/GROUP_NAME
additional_fs_utils:
  - xfsprogs     # package for mkfs.xfs on RedHat / Ubuntu
  - btrfs-progs  # package for mkfs.btrfs on CentOS / Debian

How it works

It uses sfdisk to partition the disk with a single primary partition spanning the entire disk. The specified filesystem will then be created with mkfs. Finally the new partition will be mounted to the specified mount path.

About

Format extra disks and attach them to different mount points.

Resources

License

Stars

Watchers

Forks

Packages

No packages published