Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Improve resource management via Hiera
Browse files Browse the repository at this point in the history
  • Loading branch information
leoarnold committed Mar 3, 2016
1 parent ec33cde commit 218695b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ with the Hiera data
```YAML
---
cups::default_queue: 'GroundFloor'
cups::queues:
cups::hiera: priority
cups_queue:
'Office':
ensure: 'printer'
uri: 'lpd://192.168.2.105/binary_p1'
Expand Down Expand Up @@ -480,12 +481,12 @@ Installs, configures, and manages the CUPS service.

* `default_queue`: The name of the default destination for all print jobs. Requires the catalog to contain a `cups_queue` resource with the same name.

* `hiera`: When set to `priority` or `merge`, Puppet will look up the Hiera key `cups_queue` to manage `cups_queue` resources. See also the [example](#using-hiera) above. Disabled by default.

* `packages`: An array with the names of all packages needed to install for CUPS and `ipptool`. Use `[]` to disable automatic package management. OS dependent defaults apply.

* `services`: An array with the names of all CUPS services to be managed. Use `[]` to disable automatic service management. OS dependent defaults apply.

* `queues`: This attribute should only be used for [Hiera lookup](#using-hiera).

* `webinterface`: Boolean value to enable or disable the CUPS web interface at [`http://localhost:631`](http://localhost:631).

#### Define: `cups::ctl`
Expand Down
10 changes: 7 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
class cups (
$confdir = $::cups::params::confdir,
$default_queue = undef,
$hiera = undef,
$packages = $::cups::params::packages,
$services = $::cups::params::services,
$queues = undef,
$webinterface = undef,
) inherits cups::params {

Expand Down Expand Up @@ -39,8 +39,12 @@
require => Package[$packages],
}

unless ($queues == undef) {
create_resources('cups_queue', $queues)
unless ($hiera == undef) {
case $hiera {
'priority': { create_resources('cups_queue', hiera('cups_queue')) }
'merge': { create_resources('cups_queue', hiera_hash('cups_queue')) }
default: { fail("Unsupported value 'hiera => ${hiera}'.") }
}
}

unless ($default_queue == undef) {
Expand Down

0 comments on commit 218695b

Please sign in to comment.