Book Image

Puppet Cookbook - Third Edition

Book Image

Puppet Cookbook - Third Edition

Overview of this book

Table of Contents (17 chapters)
Puppet Cookbook Third Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Generating manifests with the Puppet resource command


If you have a server that is already configured as it needs to be, or nearly so, you can capture that configuration as a Puppet manifest. The Puppet resource command generates Puppet manifests from the existing configuration of a system. For example, you can have puppet resource generate a manifest that creates all the users found on the system. This is very useful to take a snapshot of a working system and get its configuration quickly into Puppet.

How to do it...

Here are some examples of using puppet resource to get data from a running system:

  1. To generate the manifest for a particular user, run the following command:

    [root@cookbook ~]# puppet resource user thomas
    user { 'thomas':
      ensure           => 'present',
      comment          => 'thomas Admin User',
      gid              => '1001',
      groups           => ['bin', 'wheel'],
      home             => '/home/thomas',
      password         => '!!',
      password_max_age => '99999...