Skip to content

Commit

Permalink
Basic stubs for cups_options provider
Browse files Browse the repository at this point in the history
  • Loading branch information
mosen committed Feb 16, 2012
1 parent 629f6cf commit bfb884a
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 4 deletions.
66 changes: 63 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
CUPS support for puppet
-----------------------
=======================

Initially will be developed to support Mac OS X printer management on the
client.
*IN DEVELOPMENT*

This module/resource aims to provide support for management of the CUPS printing system.

Primarily it will be used to add and remove printers from client machines running the Mac OS X operating system,
although it should be generic enough to use with any linux/bsd variety with CUPS installed.

It may eventually be used to manage permissions and options for the cups daemon.


Facter Facts
============

A list of facter facts provided by the module.

printers
--------

Provides a list of installed printers.


Resource Types
==============

A list of resource types provided by the module.

printer
-------

The printer resource type is used to add and remove printers from a puppet node.

__Example__

```
# Printer resource sample : all parameters listed (except for ppd options, which depend on the ppd).
printer { "Printer_A":
ensure => present,
uri => "lpd://localhost/printer_a",
description => "This is the printer description",
location => "Main office",
ppd => "/Library/Printers/PPDs/Printer.ppd",
enabled => true, # Enabled by default
shared => false, # Disabled by default
options => [], # Not yet supported: array of PPD options
}
```

printer_defaults
----------------

The printer defaults resource type is used to define default options for the CUPS printing system.

__Example__


```
printer_defaults { "media":
ensure => present,
value => "A4",
}
```
2 changes: 2 additions & 0 deletions lib/puppet/provider/printer/cups.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# TODO: Consider enable/disable, accept/reject and options as property methods.

Puppet::Type.type(:printer).provide :cups, :parent => Puppet::Provider do
desc "This provider manages installed printers using CUPS command line tools"

Expand Down
18 changes: 18 additions & 0 deletions lib/puppet/provider/printer/cups_options.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Puppet::Type.type(:printer_defaults).provide :cups_options, :parent => Puppet::Provider do
desc "This provider manages default printer options using CUPS command line tools"

commands :lpoptions => "/usr/bin/lpoptions"
commands :lpinfo => "/usr/sbin/lpinfo"

def create

end

def destroy

end

def exists?

end
end
16 changes: 15 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
ppd => "/Library/Printers/PPDs/Printer.ppd",
enabled => true, # Enabled by default
shared => false, # Disabled by default
options => [], # Not yet supported: array of PPD options
options => {}, # Not yet supported: hash of PPD options
}

# Printer resource sample : the recommended minimum parameters.
Expand All @@ -26,4 +26,18 @@
printer { "Printer_C":
ensure => absent,
}

# Mac OS X should use the operatingsystem version to figure out the PPD location.
# Some drivers are localised, and some are not. Usually 10.5 drivers are not.
# You can use your own logic to determine how the path will be set in any case.
$ppd_localedir = $macosx_productversion ? {
/10\.5/ => "",
default => "en.lproj/" # your own locale
}

printer { "osx_printer":
ensure => present,
ppd => "/Library/Printers/PPDs/{$ppd_localedir}Printer.ppd",
# ..etc
}
}

0 comments on commit bfb884a

Please sign in to comment.