Let's reorganize the manifest to move the /tmp/hello
file within a node declaration for the demo
server.
Create the file
manifests/nodes.pp
with the following contents:node 'demo' { file { '/tmp/hello': content => "Hello, world\n", } }
Change the
manifests/site.pp
file so it contains:import 'nodes.pp'
Your puppet directory should now look as shown in the following diagram:
Check whether everything still works:
ubuntu@demo:~/puppet$ puppet apply manifests/site.pp Notice: Finished catalog run in 0.03 seconds
When you run puppet
apply, Puppet looks at the hostname of the machine (demo
in this case) and tries to find a node declaration that matches it. It finds one:
node 'demo' { file { '/tmp/hello': content => "Hello, world\n", } }
So it will apply everything within the node 'demo'
declaration, which in our example has already been applied, so there's nothing for Puppet to do for now.
Although Puppet doesn...