Book Image

LEARNING PUPPET

Book Image

LEARNING PUPPET

Overview of this book

Table of Contents (17 chapters)
Learning Puppet
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Managing resources with the puppet apply command


We can apply this resource to the --execute (or -e) puppet apply command, which will remove the user Elisa from the system.

As Elisa no longer exists in the system, let's change the ensure attribute value to 'present' so that Puppet can create the user Elisa:

puppet apply --execute "user { 'Elisa':  ensure => 'present', }"

Puppet will display the following output on the screen:

As you might have noticed, the output of the puppet apply command looks different from the puppet resource command that we used earlier to create user Elisa. Let's examine the output line by line:

  • Line 1: Notice: Compiled catalog for learning.puppetlabs.vm in environment production in 0.12 seconds

    The Puppet report shows that the manifest was compiled successfully in 0.12 seconds. The manifest was compiled for the learning.puppetlabs.vm Puppet host. The learning.puppetlabs.vm Puppet host is a member of the Puppet environment called production.

  • Line 2: Notice: /Stage[main]/Main/User[Elisa]/ensure: created

    The Puppet report shows that the user Elisa was created successfully on the system.

  • Line 3: Notice: Finished catalog run in 0.22 seconds

    The Puppet report shows that the Puppet run was completed successfully in 0.22 seconds.

The preceding three lines relate to the following different stages of the Puppet run:

  1. Before Puppet can apply the manifest or a set of manifests, it performs an operation where it compiles a catalogue. A catalogue is a collection of Puppet manifests. During the compilation stage, Puppet looks for possible errors in the manifest files and ensures that the manifests were correctly formatted.

  2. Once the catalogue is compiled, Puppet moves on to the second stage where it applies the catalogue to the system.

  3. The last step of the process is to produce a report of the results of the Puppet run.