Puppet: Handling system resources in puppet.

0 votes
What are resources and how do you handle system resources in puppet?
Aug 28 in Puppet by Ashritha
22 views

1 answer to this question.

0 votes

System resources are the key elements of a Puppet code that defines the architecture and manages the configuration of a system infrastructure.

Puppet has its own DML (Declarative Modelling Language) to write code.

The main unit of code is called a resource.

Puppet uses various types of resources to define the different definitions and parameters of a system.

Here is how a resource is written:

resource_type { ‘resource_name’:
attribute => value,
attribute => value,
…
}

Each resource has 3 items: Resource_type, resource_name and the attributes.

Example:

user { ‘Jack’:
ensure => present,
owner => ‘root',
group => ‘home’,
mode => 0644,
shell => ‘/bin/bash’
}

This code evaluates as:
Resource type ‘user’ with the resource parameter ‘Jack’ have the attributes: ‘ensure’, ‘owner’, ‘group’, ‘mode’ and ‘shell’.

These attributes have the respective values.

We can get a list of all the available resource types with the command:

puppet describe --list

Some of the common resource types are:

  • user

  • package

  • exec

  • file

  • service

Example of resource_type: ‘service’. This resource ensures that the service: ‘network’ is running

service 

{‘network’ :
ensure => running
}
This resource checks the ‘package’: ‘apache’ is running and its pre-requisite requires ‘apt-update’ command to be executed.
package { ‘apache’ :
require => Exec[‘apt-update’],
ensure => running
}
answered Aug 28 by Sirajul
• 37,480 points

Related Questions In Puppet

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Service already defines error in Puppet

Hey @Rohan, try this: class MyClass { ...READ MORE

answered Feb 9 in Puppet by Monish
56 views
0 votes
1 answer

What are profiles in Puppet?

Wrapper classes that use multiple component modules ...READ MORE

answered Feb 15 in Puppet by Sheela
31 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
212 views
0 votes
1 answer
0 votes
1 answer

what are Resources in puppet?

Resources are the fundamental unit for modeling ...READ MORE

answered Jul 24 in Puppet by Sirajul
• 37,480 points
25 views
0 votes
1 answer

Puppet+Kubernetes : List and manage kubernetes resources in puppet

List resources: In addition to creating and managing ...READ MORE

answered Aug 22 in Puppet by Sirajul
• 37,480 points
15 views