This cookbook will setup the media devices on a server which will ideally act as a file/media server. Initially it will be used to mount external devices and add then as NFS shares.
This cookbook requires devices to be preformatted to a file system. It will not format the devices. It will simply mount the specified devices for using as a file/media server.
For cookbook dependencies/requirements see metadata.rb
.
Prepare the node['media']['devices']
node attribute and use the
media::default
or media::mount_devices
recipe. There is no need for
specifying the file system types. It is automatically detected and used for
mounting the devices. Devices can also be specified by uuid
and label
.
# Prepare the media devices
node.set['media']['devices'] = {
'/dev/sdb1' => '/mnt/videos',
'/dev/disk/by-uuid/C398398878' => '/mnt/movies',
'/dev/disk/by-label/songs' => '/mnt/songs'
}
# Include the recipe
include_recipe "media::default"
It is recommended that you set up the devices by UUID because the device
location cannot always be the same and can lead to confusion. The UUID and
label can be found using the blkid
command on Unix. This command will give
the label, uuid, and the file system type.
Example:
$ sudo blkid /dev/sdb1
$ /dev/sdb1: LABEL="movies" UUID="C60475200468787521" TYPE="ntfs"
By default the mounted devices mount points are used for setting up the NFS
shares. It can be overridden by setting the node['media']['nfs']['shares']
node attribute. Then run the media::setup_nfs_shares
recipe.
node['media']['devices']
- The media devices to mountnode['media']['user']
- The user to be used for media mount pointsnode['media']['group']
- The group to be used for media mount pointsnode['media']['nfs']['shares']
- The NFS shares to setupnode['media']['nfs']['network']
- The NFS network address to share withnode['media']['nfs']['writable']
- The writeable property of NFS sharenode['media']['nfs']['sync']
- The sync property of NFS sharenode['media']['nfs']['options']
- The options to be used for the NFS share
This is the default recipe. It just runs the media::mount_devices
recipe.
This recipe mounts the specified media devices in the mount points given. See Usage for more details.
This recipe installs the requied packages for NFS server and sets up the nfs shares.
This recipe sets up the minidlna media server. Example for setting this up:
node.set['minidlna']['video_directories'] = [
'/media/storage/movies',
'/media/storage/shows'
]
node.set['minidlna']['friendly_name'] = "Kannan's minidlna"
include_recipe "media::setup_minidlna"
Author:: Kannan Manickam ([email protected])