Generating manifests with puppet resource
If you have a server which 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 for taking a snapshot of a working system and getting its configuration quickly into Puppet.
How to do it…
Here are some examples of using puppet resource
to get data from a running system:
To generate the manifest for a particular user, run the following command:
ubuntu@cookbook:~/puppet$ puppet resource user ubuntu user { 'ubuntu': ensure => 'present', comment => 'Ubuntu', gid => '1000', groups => ['adm', 'dialout', 'cdrom', 'floppy', 'audio', 'dip', 'video', 'plugdev', 'netdev', 'admin'], home => '/home/ubuntu', shell => '/bin/bash', uid ...