Learning Puppet Manifests Files with Examples for Beginners

learning puppet manifests, puppet manifest, puppet, manifest, puppet manifest tutorial, puppet manifests with examples, puppet manifest syntax, puppet learning


In this article, we will describe you how to use and write Puppet Manifest files and manifest Syntax to understand how to manage your complete Infrastructure servers.

Also refer other puppet related articles which are very essential to understand the puppet from the beginning.,

What is puppet, how puppet works?
How to install puppet master and puppet agents?
Understand the basics of puppet manifests files with examples
Understand the basics of puppet Modules
Install Puppet Modules Online and Offline

Learning Puppet Manifests Files with Examples for Beginners

What is Puppet Manifests?
Manifests are files with extension ".pp" will be created at the puppet master end, where we declare all the resource types to be managed.

Resources might be files, packages, services and so on. To know more, refer this puppet fundamentals about manifests.

Syntax of Manifests
Sample syntax:
resourcetype { 'title':
  argument or attribute1  => value,
  argument or attribute2 => value,
}
Lets take an example scenario that, we have 1000+ servers which are connected with our puppet master server. We have requirement to do some operation changes to manage your all 1000+ servers.

Scenario Requirements:
1. Modifying the file /etc/motd in all infrastructure servers to add a content using puppet automation.
2. Stopping Postfix service in all servers.

In all servers, we have already installed puppet agents and connected with puppet master. Refer this to link to install puppet master and puppet agents. Now what are actions we perform in order to do these requirements in a single server if we dont have any automation softwares not implemented like puppet.

Mainly we do these below actions for these resources file /etc/hosts and service postfix.

ALSO WATCH THIS PUPPET MANIFESTS TUTORIAL VIDEO FREE ON OUR YOUTUBE CHANNEL


For file /etc/motd :
1. We will ensure whether the file present or not
2. If present, then we will do the required changes.
3. If need, We will change file permissions.
[ads-post]
For service postfix.
1. We will ensure whether the service exists or not.
2. If exist, ensure its running or not
3. If running, stop it.

This is what our requirement.

Lets do these actions by writing in the puppet manifest files.
[root @puppetmaster ~] vi /etc/puppet/manifests/site.pp
node default {

file {'/etc/motd':
        content => 'This is my testing content',
      }
service {'postfix':
  ensure => 'stopped',
  enable => 'false',
}
}
This is how we can write the manifest files to manage our complete infrastructure servers.
Note : In the first line, we have defined to apply the changes for all default nodes which are connected to puppet master server. If you want to do these changes for one server, change as "node linuxdb1.learnitguide.net". So changes will apply only to the particular puppet agent node.

Testing the changes at the Puppet agent client nodes:
By default, Puppet agents will give request to puppet master to check any changes for every 30mins interval or manually run the below command on one server to test.
[root @puppetagent ~] puppet agent -t
Thats all about use and write puppet manifests files to manage our infrastructure servers.
Also refer other puppet related articles which are very essential to understand the puppet from the beginning.,

What is puppet, how puppet works?
How to install puppet master and puppet agents?
Understand the basics of puppet manifests files with examples
Understand the basics of puppet Modules
Install Puppet Modules Online and Offline
learning puppet manifests, puppet manifest, puppet, manifest, puppet manifest tutorial, puppet manifests with examples, puppet manifest syntax, puppet learning, puppet tutorial manifests, how to manage infrastructure, manage infrastructure using puppet
More topics will be added soon. Stay connect with us. To not miss any updates, Follow us on social networking sites @Learnitguide and Subscribe us on our Youtube channel @Learnitguidenetblog.
puppet automation tool, devops puppet, puppet tutorials, puppet apply manifests, puppet managing linux infrastructure, how to write puppet manifests, puppet manifests file site.pp, puppet manifests tutorials for beginners

October 23, 2016

Post a Comment

[disqus][facebook][blogger]

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget