Prepare better with the best interview questions and answers, and walk away with top interview tips. These interview questions and answers will boost your core interview skills and help you perform better. Be smarter with every interview.
Puppet is an Open-Source Configuration Management tool.It could be used on Unix and Windows Platforms. It uses its own declarative language using manifests to describe system configuration.
Puppet is one of the most widely used configuration management tools. It is used for deploying , configuring and managing servers.
It is used for the below.
Resournces are fundamental units for modelling system configurations which describes attributes of of system, like a specific package users and networking ..etc.
Below is an example of a user resource declaration:
user { 'andrew': ensure => present, uid => '100', gid => '100', shell => '/bin/bash', home => '/home/andrew' }
Every resource is associated with a resource type, which provides the details of kind of configuration it manages. It has many built-in resource types, like files, cron jobs, services, etc.
Custom resource types are written in Ruby, and have access to the same capabilities as Puppet’s built-in types.
Collection of resources which are grouped together to have a desired machine in a desired state. They are defined inside Puppet manifest files which are found in Puppet modules.
A class definition has the details of the codes which are used in the class. Defining a class makes the class available to be used in manifests, but does not actually evaluate anything.
Class Definition Example:
class example_class { ... code ... }
The above defines a class named "example_class", and the Puppet code would go between the curly braces.
Before requesting a catalog , Puppet will collect system information with Facter. Puppet receives this information as facts, which are pre-set variables you can use anywhere in your manifests.
Puppet can access Facter’s built-in core facts and custom facts which are present in the modules.
Puppet supports functions.It supports two types of functions known with the name of statement and rvalue functions.
You can write your own functions in the Puppet language to transform data and construct values. A function can optionally take one or more parameters as arguments. A function returns a calculated value from its final expression.
Function Syntax in Puppet:
function <MODULE NAME>::<NAME>(<PARAMETER LIST>) >> <RETURN TYPE> { ... body of function ... final expression, which will be the returned value of the function}
Function Example in Puppet:
function apache::bool2http(Variant[String, Boolean] $arg) >> String { case $arg { false, undef, /(?i:false)/ : { 'Off' } true, /(?i:true)/ : { 'On' } default : { "$arg" } }}
A catalog is a document that describes the desired system state for one specific computer. It lists all of the resources that need to be managed, as well as any dependencies between those resources.
Puppet configures systems in two stages:
Compile a catalog & Apply the catalog.
Below are the steps for installing Puppet on Linux Platform.
All the programs in Puppet are written using Ruby programming language and saved with an extension of .pp are called manifests. All the programs written in Puppet follow Puppet coding style.
Puppet manifest consists of the following components
Puppet Module is a collection of Manifests and data which have a specific directory structure. Modules are useful for organizing your Puppet code in which you can split your code into multiple Manifests. It is considered best practice to use Modules while working with Manifests.
Execute puppet cert list command in Puppet Master to check requests of Certificates from Puppet Agent.
Puppet’s codedir is the main directory for Puppet code and data. It contains environments and Hiera data.
It is found in the below locations:
*nix Systems: /etc/puppetlabs/codeWindows: %PROGRAMDATA%\PuppetLabs\code (usually C:\ProgramData\PuppetLabs\code)non-root users: ~/.puppetlabs/etc/code
Environments are isolated groups of Puppet agent nodes. A Puppet master serves each environment with its own main manifest and module path. This lets you use different versions of the same modules for different groups of nodes, which is useful for testing changes to your Puppet code before implementing them on production machines.
Types of environments
Permanent Test Environment : Environment in which there is a stable group of test nodes where all changes must succeed before they can be merged into the production code. The test nodes are a smaller version of the whole production infrastructure.
Temporary test environment : Test a single change or group of changes by checking the changes out of version control into the $codedir/environments directory, where it will be detected as a new environment.
Hiera is a key/value lookup used for separating data from Puppet Code. It is used for Storing the configuring data in key-value pairs and to search what data a module needs for a given during node during catalog compilation.
Hiera supports JSON , YAML and EYAML files
MCollective is a powerful orchestration framework which is used to run actions on thousands of servers simultaneously, using existing plugins or writing your own.
Puppet always starts compiling using a single manifest file. This main starting point is called the main manifest or site manifest.
Puppet supports several kinds of plug-ins:
This command provides an interface for managing modules from the Puppet Forge. Its interface is similar to several common package managers. You can use the puppet module command to search for, install, and manage modules.
For example, to install the puppetlabs-apache module, run:
puppet module install puppetlabs-apache
Use the puppet module install command with the full name of the module you want.
The full name of a Forge module is formatted as username-modulename. For example, to instal puppetlabs-apache:
puppet module install puppetlabs-apache
Puppet Module list command will list all the modules which have been installed and which directory they’re installed in.
# verify the module is installed $ sudo /opt/puppetlabs/bin/puppet module list /etc/puppetlabs/code/environments/production/site |-- garethr-docker (v5.3.0)
PSON is a variant of JSON which puppet uses for serializing data to transmit across the network or store on disk. JSON requires that the serialized form is valid unicode (usually UTF-8). A PSON string is a sequence of 8-bit ASCII encoded data. It must start and end with “(ASCII 0x22) characters.
Puppet and facter can be upgraded through operating system package management system. This could be done either through the vendor’s repository or through the Puppet Labs’ public repositories.
Facter is a library that reports and discovers the facts details and send them to the puppet master. The facts details may include the operating system, SSH keys, IP address, MAC addresses, either it is a virtual machine or not etc.
When a node is configured, puppet agent uses a document that is termed as the Catalog and it can be downloaded from the Puppet Master. It has the state details of each resource that will be managed in a specific order. The data stored in Puppet Catalog is driven by three facts
Puppet is suitable for any organization size. The main objective of Puppet is to manage or configure a plenty of servers together using automation.
Commands that are used to sign the request certificates for master-slave authentication. These commands are used by the puppet slave.
Below, are the commands that are used by the puppet master to sign the requested certificates by puppet agent.
Puppet ca sign hostname-of-agent (3.0)
Command for locating the file where signed certifications are stored.
/var/lib/puppet/ssl/ca/signed
Puppet uses a unique approach where it models everything like the present state of the node, the configuration details, SSH keys, modules, Catalog etc. The major benefits of the tool are that complete configuration details are stored securely, even in case of failure, same system state would be generated again later.
Puppet uses its programming language as it is more declarative and can be quickly understood by developers which is more easy to understand compared to other programming languages.
Puppet is an Open-Source Configuration Management tool.It could be used on Unix and Windows Platforms. It uses its own declarative language using manifests to describe system configuration.
Puppet is one of the most widely used configuration management tools. It is used for deploying , configuring and managing servers.
It is used for the below.
Resournces are fundamental units for modelling system configurations which describes attributes of of system, like a specific package users and networking ..etc.
Below is an example of a user resource declaration:
user { 'andrew': ensure => present, uid => '100', gid => '100', shell => '/bin/bash', home => '/home/andrew' }
Every resource is associated with a resource type, which provides the details of kind of configuration it manages. It has many built-in resource types, like files, cron jobs, services, etc.
Custom resource types are written in Ruby, and have access to the same capabilities as Puppet’s built-in types.
Collection of resources which are grouped together to have a desired machine in a desired state. They are defined inside Puppet manifest files which are found in Puppet modules.
A class definition has the details of the codes which are used in the class. Defining a class makes the class available to be used in manifests, but does not actually evaluate anything.
Class Definition Example:
class example_class { ... code ... }
The above defines a class named "example_class", and the Puppet code would go between the curly braces.
Before requesting a catalog , Puppet will collect system information with Facter. Puppet receives this information as facts, which are pre-set variables you can use anywhere in your manifests.
Puppet can access Facter’s built-in core facts and custom facts which are present in the modules.
Puppet supports functions.It supports two types of functions known with the name of statement and rvalue functions.
You can write your own functions in the Puppet language to transform data and construct values. A function can optionally take one or more parameters as arguments. A function returns a calculated value from its final expression.
Function Syntax in Puppet:
function <MODULE NAME>::<NAME>(<PARAMETER LIST>) >> <RETURN TYPE> { ... body of function ... final expression, which will be the returned value of the function}
Function Example in Puppet:
function apache::bool2http(Variant[String, Boolean] $arg) >> String { case $arg { false, undef, /(?i:false)/ : { 'Off' } true, /(?i:true)/ : { 'On' } default : { "$arg" } }}
A catalog is a document that describes the desired system state for one specific computer. It lists all of the resources that need to be managed, as well as any dependencies between those resources.
Puppet configures systems in two stages:
Compile a catalog & Apply the catalog.
Below are the steps for installing Puppet on Linux Platform.
All the programs in Puppet are written using Ruby programming language and saved with an extension of .pp are called manifests. All the programs written in Puppet follow Puppet coding style.
Puppet manifest consists of the following components
Puppet Module is a collection of Manifests and data which have a specific directory structure. Modules are useful for organizing your Puppet code in which you can split your code into multiple Manifests. It is considered best practice to use Modules while working with Manifests.
Execute puppet cert list command in Puppet Master to check requests of Certificates from Puppet Agent.
Puppet’s codedir is the main directory for Puppet code and data. It contains environments and Hiera data.
It is found in the below locations:
*nix Systems: /etc/puppetlabs/codeWindows: %PROGRAMDATA%\PuppetLabs\code (usually C:\ProgramData\PuppetLabs\code)non-root users: ~/.puppetlabs/etc/code
Environments are isolated groups of Puppet agent nodes. A Puppet master serves each environment with its own main manifest and module path. This lets you use different versions of the same modules for different groups of nodes, which is useful for testing changes to your Puppet code before implementing them on production machines.
Types of environments
Permanent Test Environment : Environment in which there is a stable group of test nodes where all changes must succeed before they can be merged into the production code. The test nodes are a smaller version of the whole production infrastructure.
Temporary test environment : Test a single change or group of changes by checking the changes out of version control into the $codedir/environments directory, where it will be detected as a new environment.
Hiera is a key/value lookup used for separating data from Puppet Code. It is used for Storing the configuring data in key-value pairs and to search what data a module needs for a given during node during catalog compilation.
Hiera supports JSON , YAML and EYAML files
MCollective is a powerful orchestration framework which is used to run actions on thousands of servers simultaneously, using existing plugins or writing your own.
Puppet always starts compiling using a single manifest file. This main starting point is called the main manifest or site manifest.
Puppet supports several kinds of plug-ins:
This command provides an interface for managing modules from the Puppet Forge. Its interface is similar to several common package managers. You can use the puppet module command to search for, install, and manage modules.
For example, to install the puppetlabs-apache module, run:
puppet module install puppetlabs-apache
Use the puppet module install command with the full name of the module you want.
The full name of a Forge module is formatted as username-modulename. For example, to instal puppetlabs-apache:
puppet module install puppetlabs-apache
Puppet Module list command will list all the modules which have been installed and which directory they’re installed in.
# verify the module is installed $ sudo /opt/puppetlabs/bin/puppet module list /etc/puppetlabs/code/environments/production/site |-- garethr-docker (v5.3.0)
PSON is a variant of JSON which puppet uses for serializing data to transmit across the network or store on disk. JSON requires that the serialized form is valid unicode (usually UTF-8). A PSON string is a sequence of 8-bit ASCII encoded data. It must start and end with “(ASCII 0x22) characters.
Puppet and facter can be upgraded through operating system package management system. This could be done either through the vendor’s repository or through the Puppet Labs’ public repositories.
Facter is a library that reports and discovers the facts details and send them to the puppet master. The facts details may include the operating system, SSH keys, IP address, MAC addresses, either it is a virtual machine or not etc.
When a node is configured, puppet agent uses a document that is termed as the Catalog and it can be downloaded from the Puppet Master. It has the state details of each resource that will be managed in a specific order. The data stored in Puppet Catalog is driven by three facts
Puppet is suitable for any organization size. The main objective of Puppet is to manage or configure a plenty of servers together using automation.
Commands that are used to sign the request certificates for master-slave authentication. These commands are used by the puppet slave.
Below, are the commands that are used by the puppet master to sign the requested certificates by puppet agent.
Puppet ca sign hostname-of-agent (3.0)
Command for locating the file where signed certifications are stored.
/var/lib/puppet/ssl/ca/signed
Puppet uses a unique approach where it models everything like the present state of the node, the configuration details, SSH keys, modules, Catalog etc. The major benefits of the tool are that complete configuration details are stored securely, even in case of failure, same system state would be generated again later.
Puppet uses its programming language as it is more declarative and can be quickly understood by developers which is more easy to understand compared to other programming languages.
Submitted questions and answers are subjecct to review and editing,and may or may not be selected for posting, at the sole discretion of Knowledgehut.