Media Chef Cookbook
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.
Requirements
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
.
Usage
For setting up the media devices
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"
Pro Tip
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"
For setting up the NFS shares
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.
Attributes
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
Recipes
media::default
This is the default recipe. It just runs the media::mount_devices
recipe.
media::mount_devices
This recipe mounts the specified media devices in the mount points given. See Usage for more details.
media::setup_nfs_shares
This recipe installs the requied packages for NFS server and sets up the nfs shares.
media::setup_minidlna
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
Author:: Kannan Manickam (me@arangamani.net)