Today is the day 1 of Learn Puppet with Me. I am starting this thread for those who want to learn Puppet smoothly.
Puppet is an Automation IT tool and I have already talked about its capabilities in my last post related to Puppet.
Let’s demystify the puppet fundamentals through this easy step.
Day 1: How to create a file with content “Hello, World” on puppet agent?
Say, I have a puppet master and agent ready. All I want is to create a file in puppet agent either running the command in puppet agent or directly fetching it from puppet master. Here we go –
Run the below commands on Puppetmaster Machine:
1. Create a directory called puppet:
#mkdir puppet
2. Change to puppet directory:
#cd puppet
3. Under it , create a subfolder called manifests:
#mkdir manifests
4. Create a file called site.pp under manifests:
#vi manifests/site.pp
import ‘nodes.pp’
5. Create a file called nodes.pp under manifest and add the following entries:
#vi manifests/nodes.pp
node’puppetagent1.cse.com’ {
file { ‘/tmp/hello’:
content => “hello, world\n”,
}
}
6. That’s all. Now test your manifests with the puppet apply command.
#puppet apply manifests/site.pp
OR
7. Run the following command on puppet agent:
# puppet agent -t
Verify if puppet created the file with the contents on the puppet agent machine.
It’s very simple way to create a file on puppet client through puppet master.
In next episode, we will talk about the Puppet Style and parameters.
Comments are closed.