1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
class nodo::role::nas {
# Minimal utilities
include nodo::utils::network::minimal
# Firewall rules
include firewall::nas
# DLNA
class { 'minidlna': }
#
# NFS
#
# References
# https://github.com/arioch/puppet-nfs
# https://github.com/stankevich/puppet-nfs
# https://github.com/camptocamp/puppet-nfs
# https://github.com/haraldsk/puppet-module-nfs/
# http://git.puppet.immerda.ch/?p=module-nfsd.git;a=summary
# http://wiki.debian.org/NFSServerSetup
# http://www.tldp.org/HOWTO/NFS-HOWTO/
# Main class
class { 'nfs':
server => true;
}
#
# FTP
#
# References
# https://forge.puppetlabs.com/tags/ftp
# https://forum.openwrt.org/viewtopic.php?id=12976
# http://download.pureftpd.org/pub/pure-ftpd/doc/FAQ
# http://www.massimilianomarini.com/04/02/2012/how-follow-symbolic-links-pure-ftpd
# Main class
class { 'pureftpd':
virtualchroot => true,
}
# Enable anonymous ftp
file { '/etc/pure-ftpd/conf/NoAnonymous':
ensure => present,
owner => root,
group => root,
mode => 0644,
content => "no\n",
notify => Service[$pureftpd::params::service_name],
}
#
# Samba
#
# References
# https://github.com/ajjahn/puppet-samba
# https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/NetworkBrowsing.html#id2583364
# http://serverfault.com/questions/240217/dd-wrt-bonjour-netbios-etc-on-two-subnets
# http://www.linuxplanet.com/linuxplanet/tutorials/6600/2
# http://forums.fedoraforum.org/showthread.php?t=260519
# http://randombio.com/linuxsetup38.html
# Main class
class { 'samba::server':
workgroup => hiera('nodo::samba::workgroup', 'WORKGROUP'),
server_string => hiera('nodo::samba::server_string', 'Samba Server'),
interfaces => hiera('nodo::samba::interfaces', 'lo eth0'),
security => hiera('nodo::samba::security', 'share'),
}
# We are avoiding multicast
# http://bda.ath.cx/blog/2009/01/24/multicast-routing-upnp-traffic-with-linux/
# http://linux-igd.sourceforge.net/documentation.php
set_samba_option {
# Remote announce won't work since routers don't forward broadcast traffic
#'remote announce': value => hiera('nodo::samba::remote_announce', '');
'wins support': value => 'yes';
'preferred master': value => 'yes';
'domain master': value => 'yes';
'printing': value => 'cups';
'printcap name': value => 'cups';
}
# Disable browsing of printer drivers
samba::server::share { 'print$':
comment => 'Printer Drivers',
path => '/var/lib/samba/printers',
browsable => 'no',
read_only => 'yes',
guest_ok => 'no',
}
#
# HTTP
#
# References
# https://github.com/camptocamp/puppet-lighttpd
# https://github.com/example42/puppet-lighttpd
# http://git.puppet.immerda.ch/?p=module-lighttpd.git;a=summary
# Main class
class { 'lighttpd': }
# Document root
file { '/var/www/data':
ensure => present,
owner => root,
group => root,
mode => 0755,
}
#
# TFTP
#
# Main class
class { 'tftp':
directory => '/srv/tftp',
address => $::ipaddress,
options => '--ipv4 --timeout 60',
inetd => false,
}
# Rsync
include rsync::server
# MPD
include mpd
include mpd::client
#
# CUPS
#
# References
# https://github.com/mosen/puppet-cups
# https://github.com/camptocamp/puppet-cups
# Package
package { [ 'cups', 'cups-client' ]:
ensure => installed,
}
#
# Avahi
#
# References
# http://nfs-lan.sevka.info/
# http://en.gentoo-wiki.com/wiki/Avahi
# http://wiki.debian.org/ZeroConf
# https://wiki.archlinux.org/index.php/Avahi
# http://packages.debian.org/wheezy/libnss-mdns
# http://packages.debian.org/wheezy/mdns-scan
# http://packages.debian.org/wheezy/avahi-discover
# http://askubuntu.com/questions/19590/how-do-i-share-nfs-mounts-over-zeroconf
# http://sophie.zarb.org/distrib/Mandriva/current/x86_64/rpms/pure-ftpd/files/1
# https://github.com/stahnma/puppet-module-avahi
# https://github.com/tjfontaine/airprint-generate
# http://mryoung.soundbomb.net/index.php/apple-airprint-with-linux-avahi
# http://lists.freedesktop.org/archives/avahi/2006-July/000824.html
# http://cups.org/documentation.php/doc-1.6/ref-cupsd-conf.html#BrowseLocalProtocols
# http://www.dns-sd.org/ServiceTypes.html
# Main class
include avahi
file { '/etc/avahi/services/rsync.service':
ensure => present,
owner => root,
group => root,
mode => 0644,
source => 'puppet:///modules/site_avahi/services/rsync.service',
notify => Service['avahi-daemon'],
}
file { '/etc/avahi/services/http.service':
ensure => present,
owner => root,
group => root,
mode => 0644,
source => 'puppet:///modules/site_avahi/services/http.service',
notify => Service['avahi-daemon'],
}
file { '/etc/avahi/services/samba.service':
ensure => present,
owner => root,
group => root,
mode => 0644,
source => 'puppet:///modules/site_avahi/services/samba.service',
notify => Service['avahi-daemon'],
}
file { '/etc/avahi/services/ftp.service':
ensure => present,
owner => root,
group => root,
mode => 0644,
source => 'puppet:///modules/site_avahi/services/ftp.service',
notify => Service['avahi-daemon'],
}
#
# DAAP
#
# References
# http://packages.debian.org/stable/forked-daapd
# http://packages.debian.org/squeeze/mt-daapd
# https://github.com/stahnma/puppet-module-daap_server
# Main class, but package not available on wheezy
#class { 'daap_server':
# collection_name => 'Noise - DAAP',
# music_dir => '/var/cache/media/noise',
#}
#
# Media folders
#
# Main classes
class { [ 'nodo::subsystem::media::folders', 'nodo::subsystem::media::groups' ]: }
# Make sure basic media exist, no matter if there is an external disk attached
$cache = hiera('nodo::media::folders', '')
if $cache != '' {
file { "${cache}":
ensure => directory,
}
}
}
|