Merge branch 'master' of bitbucket.org:tmakinen/puppet
This commit is contained in:
commit
9b243b66d7
2 changed files with 17 additions and 4 deletions
|
@ -101,6 +101,8 @@ class cups::server inherits cups::client {
|
||||||
# Printer name.
|
# Printer name.
|
||||||
# $uri:
|
# $uri:
|
||||||
# URI to use for connecting to printer device.
|
# URI to use for connecting to printer device.
|
||||||
|
# $location:
|
||||||
|
# Printer location. Use "LDAP" to fetch location information from LDAP.
|
||||||
# $ensure:
|
# $ensure:
|
||||||
# If set to present printer will be installed and if set to absent
|
# If set to present printer will be installed and if set to absent
|
||||||
# printer will be removed.
|
# printer will be removed.
|
||||||
|
@ -112,10 +114,15 @@ class cups::server inherits cups::client {
|
||||||
# uri => "socket://hp1:9100,
|
# uri => "socket://hp1:9100,
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
define cups::printer($uri, $ensure = present) {
|
define cups::printer($uri, $location = "", $ensure = present) {
|
||||||
|
|
||||||
$hostname = regsubst($uri, '^[a-z]*://(.*)[:/].*', '\1')
|
$hostname = regsubst($uri, '^[a-z]*://(.*)[:/].*', '\1')
|
||||||
$location = template("cups/printer-location.erb")
|
|
||||||
|
if $location == "LDAP" {
|
||||||
|
$_location = template("cups/printer-location.erb")
|
||||||
|
} else {
|
||||||
|
$_location = $location
|
||||||
|
}
|
||||||
|
|
||||||
case $ensure {
|
case $ensure {
|
||||||
present: {
|
present: {
|
||||||
|
@ -128,9 +135,9 @@ define cups::printer($uri, $ensure = present) {
|
||||||
exec { "cups-set-location-${name}":
|
exec { "cups-set-location-${name}":
|
||||||
command => "lpadmin -p ${name} -L '${location}'",
|
command => "lpadmin -p ${name} -L '${location}'",
|
||||||
path => "/bin:/sbin:/usr/bin:/usr/sbin",
|
path => "/bin:/sbin:/usr/bin:/usr/sbin",
|
||||||
unless => $location ? {
|
unless => $_location ? {
|
||||||
"" => "lpoptions -p ${name} | egrep ' printer-location '",
|
"" => "lpoptions -p ${name} | egrep ' printer-location '",
|
||||||
default => "lpoptions -p ${name} | egrep ' printer-location=${location} '",
|
default => "lpoptions -p ${name} | egrep ' printer-location=${_location} '",
|
||||||
},
|
},
|
||||||
require => Exec["cups-add-printer-${name}"],
|
require => Exec["cups-add-printer-${name}"],
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,6 +342,9 @@ class syslog::standalone::syslogd inherits syslog::client::syslogd {
|
||||||
require => [ File["/srv/log"],
|
require => [ File["/srv/log"],
|
||||||
File["/var/log/all.log"], ],
|
File["/var/log/all.log"], ],
|
||||||
}
|
}
|
||||||
|
Service["syslogd"] {
|
||||||
|
subscribe => File["/srv/log"],
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,6 +360,9 @@ class syslog::standalone::rsyslog inherits syslog::client::rsyslog {
|
||||||
require => [ File["/srv/log"],
|
require => [ File["/srv/log"],
|
||||||
File["/var/log/all.log"], ],
|
File["/var/log/all.log"], ],
|
||||||
}
|
}
|
||||||
|
Service["rsyslog"] {
|
||||||
|
subscribe => File["/srv/log"],
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue