Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
# Configure Apt for example repository define apt::key($ensure) { # adding or deleting keys $apt_key_url = "http://apt.example.com/apt/keys" case $ensure { "present": { exec { "apt-key present $name": command => "/usr/bin/wget -q $apt_key_url/$name -O -|/usr/bin/apt-key add -", unless => "/usr/bin/apt-key list|/bin/grep -c $name", } } "absent": { exec { "apt-key absent $name": command => "/usr/bin/apt-key del $name", onlyif => "/usr/bin/apt-key list|/bin/grep -c $name", } } default: { fail "Invalid 'ensure' value '$ensure' for apt::key" } } } class apt::examplekeys { # just a collection # define any key you want to be present or absent here apt::key{ "458F2AD8": # sysop demi god ensure => "present", } } class apt { include apt::examplekeys exec { "apt-get-update": # refreshonly => true, command => "/usr/bin/apt-get update", require => Class["apt::examplekeys"], } # Source Repositories file { "/etc/apt/sources.list": owner => "root", group => "root", mode => 0444, ensure => "present", content => template("apt/sources.list.erb"), notify => Exec["apt-get-update"], } file { "/etc/apt/apt.conf": owner => "root", group => "root", mode => 0444, ensure => "present", source => "puppet:///apt/apt.conf", notify => Exec["apt-get-update"], } }
This paste will be private.
From the Design Piracy series on my blog: