Puppet
Describe what a computer should look like
Suppose two computers need the same file and settings. Doing the setup by hand can leave them different. Puppet lets you write down the state you want, then compare that plan with the computer's current state. A manifest is the file containing those instructions. Puppet applies changes needed to reach the declared state.
A resource describes one thing to manage. It has a type, a title, and attributes. The type says what Puppet manages; the title identifies this instance; attributes describe its desired properties. Titles for resources of the same type must be unique in a catalog, Puppet's compiled set of instructions for a machine. In a client-server setup, Puppet compiles manifests and other data into a catalog for each node, and the agent applies it. puppet apply can apply a manifest locally without that agent-server workflow.
This resource asks Puppet to manage a file:
file { '/tmp/puppet-example.txt':
ensure => file,
content => 'Managed by Puppet',
mode => '0644',
}
It describes a regular file, its contents, and its permissions. Applying the example normally changes the local filesystem, even though the path is under /tmp. Review every managed path before applying a manifest, especially when a resource could replace or remove existing data.
Preview before applying
Save the declaration as example.pp and ask Puppet what it would change:
puppet apply --noop example.pp
No-op mode reports proposed changes without applying them. Read the output alongside the manifest. A preview cannot decide whether the path, owner, permissions, or desired contents are right for your situation. If the plan is correct and you have the required permissions, run puppet apply example.pp to make the changes. Then inspect the file and run the manifest again to see whether the computer is already in sync.
Resources that describe desired state are generally idempotent: after the state matches, another run should leave it unchanged. The behavior depends on the resource and its declaration. An exec resource runs a command. It can repeat side effects unless the command is naturally safe to repeat or has conditions such as creates, onlyif, or unless to prevent unnecessary runs. Treat arbitrary commands as actions that need clear synchronization rules.
Set the order of changes
Puppet also needs to know when one resource depends on another. Use relationship syntax or metaparameters to say that one resource must be applied before another. Do not rely on the order of declarations in a manifest. For the file above, a successful apply should leave a regular file with the declared text and mode 0644. A later run should report no change if the file still has that state.







