summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-26 16:16:34 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-26 16:16:34 +0200
commit8dcdb7000b481b9afaa3244e86cc9111c74142fd (patch)
tree71ccf61cf6441397c6e9962537b06b0d25536025
parentyes|no => true|false (diff)
downloadpuppet-mpd-8dcdb7000b481b9afaa3244e86cc9111c74142fd.tar.gz
puppet-mpd-8dcdb7000b481b9afaa3244e86cc9111c74142fd.tar.xz
Types and defaults.
-rw-r--r--manifests/server.pp76
1 files changed, 40 insertions, 36 deletions
diff --git a/manifests/server.pp b/manifests/server.pp
index 584a11f..0c4169e 100644
--- a/manifests/server.pp
+++ b/manifests/server.pp
@@ -1,45 +1,49 @@
type Permission = Enum['read', 'add', 'control', 'admin']
+type Password = Struct[{ name => String, permissions => Array[Permission]}]
+
+type Metadata = Variant[Enum['none'],
+ Array[Enum['artist', 'album', 'title',
+ 'track', 'name', 'genre',
+ 'date', 'composer', 'performer',
+ 'comment', 'disc']]]
+
# See mpd(5)
# TODO
# audio_output, take mpd::output and get name
-class mpd::server (
+define mpd::server (
String $music_directory,
- String $mpd_home = '/var/lib/mpd',
- Boolean $follow_outside_symlinks = true,
- Boolean $follow_inside_symlinks = true,
- String $db_file = "${mpd_home}/database",
- String $sticker_file = "${mpd_home}/sticker.sql",
- String $log_file = "${mpd_home}/log",
- String $pid_file = "${mpd_home}/pid",
- String $playlist_directory = "${music_directory}/playlists",
- String $state_file = "${mpd_home}/state",
- String $user = 'mpd',
- String $bind_to_address = 'any',
- Integer $port = 6600,
- Enum['default','secure','verbose'] $log_level = default,
- Boolean $zeroconf_enabled = true,
- Optional[String] $zeroconf_name,
- Optional[Array[Struct[{ name => String, permissions => Array[Permission]}]]] $password,
- Optional[Array[Permission]] $default_permissions,
- Optional[String] $audio_output_format,
- Optional[Variant[Integer,String]] $samplerate_converter,
- Optional[Enum['off', 'album', 'track', 'auto']] $replaygain,
- Optional[Integer[-15,15]] $replaygain_preamp,
- Optional[Boolean] $volume_normalization,
- Optional[Integer] $audio_buffer_size,
- Optional[Integer[0,100]] $buffer_before_play,
- Optional[String] $filesystem_charset,
- Optional[String] $id3v1_encoding,
- Optional[Boolean] $gapless_mp3_playback,
- Boolean $save_absolute_paths_in_playlists = true,
- Optional[Variant[Enum['none'],
- Array[Enum['artist', 'album', 'title',
- 'track', 'name', 'genre',
- 'date', 'composer', 'performer',
- 'comment', 'disc']]]] $metadata_to_use,
- Boolean $auto_update = true,
- Optional[Integer] $auto_update_depth,
+ String $mpd_home = '/var/lib/mpd',
+ Boolean $follow_outside_symlinks = true,
+ Boolean $follow_inside_symlinks = true,
+ String $db_file = "${mpd_home}/database",
+ String $sticker_file = "${mpd_home}/sticker.sql",
+ String $log_file = "${mpd_home}/log",
+ String $pid_file = "${mpd_home}/pid",
+ String $playlist_directory = "${music_directory}/playlists",
+ String $state_file = "${mpd_home}/state",
+ String $user = 'mpd',
+ String $bind_to_address = 'any',
+ Integer $port = 6600,
+ Enum['default','secure','verbose'] $log_level = 'default',
+ Boolean $zeroconf_enabled = true,
+ Optional[String] $zeroconf_name = undef,
+ Optional[Array[Password]] $password = undef,
+ Optional[Array[Permission]] $default_permissions = undef,
+ Optional[String] $audio_output_format = undef,
+ Optional[Variant[Integer,String]] $samplerate_converter = undef,
+ Optional[Enum['off', 'album', 'track', 'auto']] $replaygain = undef,
+ Optional[Integer[-15,15]] $replaygain_preamp = undef,
+ Optional[Boolean] $volume_normalization = undef,
+ Optional[Integer] $audio_buffer_size = undef,
+ Optional[Integer[0,100]] $buffer_before_play = undef,
+ Optional[String] $filesystem_charset = undef,
+ Optional[String] $id3v1_encoding = undef,
+ Optional[Boolean] $gapless_mp3_playback = undef,
+ Boolean $save_absolute_paths_in_playlists = true,
+ Optional[Metadata] $metadata_to_use = undef,
+ Boolean $auto_update = true,
+ Optional[Integer] $auto_update_depth = undef,
) {
concat { '/etc/mpd.conf':