161 lines
3.3 KiB
Puppet
161 lines
3.3 KiB
Puppet
|
|
# Install and configure cups client
|
|
#
|
|
class cups::client {
|
|
|
|
package { "cups":
|
|
ensure => installed,
|
|
}
|
|
|
|
file { "/etc/cups/client.conf":
|
|
ensure => present,
|
|
content => template("cups/client.conf.erb"),
|
|
mode => 0644,
|
|
owner => root,
|
|
group => $operatingsystem ? {
|
|
openbsd => wheel,
|
|
default => lp,
|
|
},
|
|
require => Package["cups"],
|
|
}
|
|
|
|
case $operatingsystem {
|
|
openbsd: {
|
|
exec { "cups-enable":
|
|
command => "echo y | cups-enable",
|
|
path => "/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin",
|
|
user => root,
|
|
unless => "readlink /usr/bin/lpr | egrep '^/usr/local/bin/lpr$'",
|
|
require => Package["cups"],
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
# Install cups server
|
|
#
|
|
class cups::server inherits cups::client {
|
|
|
|
package { [ "ghostscript", "system-config-printer" ]:
|
|
ensure => installed,
|
|
}
|
|
|
|
service { "cups":
|
|
ensure => running,
|
|
enable => true,
|
|
require => Package["cups"],
|
|
}
|
|
|
|
File["/etc/cups/client.conf"] {
|
|
content => "ServerName 127.0.0.1\n",
|
|
}
|
|
|
|
}
|
|
|
|
|
|
# Install LP support into cups
|
|
#
|
|
class cups::lpd {
|
|
|
|
include cups::server
|
|
include inetd::server
|
|
|
|
package { "cups-lpd":
|
|
ensure => installed,
|
|
}
|
|
|
|
inetd::service { "cups-lpd":
|
|
ensure => present,
|
|
require => Package["cups-lpd"],
|
|
}
|
|
|
|
}
|
|
|
|
|
|
# Install samba support into cups
|
|
#
|
|
class cups::samba {
|
|
|
|
include samba::server
|
|
|
|
file { [ "/etc/samba/drivers",
|
|
"/usr/share/cups/drivers",
|
|
"/usr/share/cups/drivers/x64", ]:
|
|
ensure => directory,
|
|
mode => 0755,
|
|
owner => root,
|
|
group => root,
|
|
require => [ Package["samba"],
|
|
Package["cups"], ],
|
|
}
|
|
|
|
define driverfile() {
|
|
file { "/usr/share/cups/drivers/${name}":
|
|
ensure => present,
|
|
source => "puppet:///cups/drivers/${name}",
|
|
mode => 0644,
|
|
owner => root,
|
|
group => root,
|
|
require => [ File["/usr/share/cups/drivers"],
|
|
File["/usr/share/cups/drivers/x64"], ],
|
|
}
|
|
}
|
|
|
|
driverfile { "cups6.inf": }
|
|
driverfile { "cups6.ini": }
|
|
driverfile { "cupsps6.dll": }
|
|
driverfile { "cupsui6.dll": }
|
|
|
|
driverfile { "ps5ui.dll": }
|
|
driverfile { "pscript.hlp": }
|
|
driverfile { "pscript.ntf": }
|
|
driverfile { "pscript5.dll": }
|
|
|
|
driverfile { "x64/cups6.inf": }
|
|
driverfile { "x64/cups6.ini": }
|
|
driverfile { "x64/cupsps6.dll": }
|
|
driverfile { "x64/cupsui6.dll": }
|
|
|
|
driverfile { "x64/ps5ui.dll": }
|
|
driverfile { "x64/pscript.hlp": }
|
|
driverfile { "x64/pscript.ntf": }
|
|
driverfile { "x64/pscript5.dll": }
|
|
|
|
file { "/etc/cron.hourly/update-printer-inf.sh":
|
|
ensure => present,
|
|
source => "puppet:///cups/update-printer-inf.sh",
|
|
mode => 0755,
|
|
owner => root,
|
|
group => root,
|
|
}
|
|
|
|
}
|
|
|
|
|
|
# Install SNMP polling into cups server
|
|
#
|
|
class cups::snmp {
|
|
|
|
package { "net-snmp-utils":
|
|
ensure => installed,
|
|
}
|
|
|
|
file { "/etc/cron.hourly/printer-details.py":
|
|
ensure => present,
|
|
source => "puppet:///cups/printer-details.py",
|
|
mode => 0755,
|
|
owner => root,
|
|
group => root,
|
|
require => Package["net-snmp-utils"],
|
|
}
|
|
|
|
exec { "create-details-dir":
|
|
command => "umask 022 ; mkdir /usr/share/doc/cups-`rpm -q --queryformat='%{VERSION}' cups`/details",
|
|
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
|
user => root,
|
|
unless => "test -d /usr/share/doc/cups-`rpm -q --queryformat='%{VERSION}' cups`/details",
|
|
require => Package["cups"],
|
|
}
|
|
|
|
}
|