Tag Archives: package

Puppet: apt-get update before Package installation

Obvious way:

1
2
3
4
package {
        'pssh': ensure => 'present',
         require  => Exec['apt-get update']
}

But if you have several package definitions with Exec in each of them — apt-get update will be executed several times.

I found a better way:

1
2
3
4
exec { "apt-update":
        command => "/usr/bin/apt-get update",
    }
Exec["apt-update"] -> Package <| |>

It'll execute apt-get update one time before Packages.

Puppet: install software

add to /etc/puppet/manifests/site.pp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class soft {
  package {
    "htop":
    ensure => "installed"
  }

  package {
    "iptraf":
    ensure => "installed"
  }
}

node default {
  include soft
}

It'll install htop and iptraf utilites to all clients.