puppet resource

1 minute read Published:

The other day while I was trying to get puppet up and running on a server, I found that you can use “puppet resource” to automatically generate puppet manifest code. If you type:

puppet resource user

It’ll show you the puppet configuration for all of the user’s on your system. You can also specify a specific user, like this:

puppet resource user root

You can do this for almost any type used in puppet.

$ puppet resource package apache2
package { 'apache2' :
    ensure => '2.2.16-1ubuntu3.1',


$ puppet resource service apache
service { 'apache':
    ensure => 'running',
    enable => 'false'

You can easily save your system’s package list and deploy it quickly if the server fails, or if you just want to make a clone for staging.