Puppet Handling system resources in puppet

0 votes
What are resources and how do you handle system resources in puppet?
Aug 28, 2019 in Puppet by Ashritha
575 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, 2019 by Sirajul
• 59,230 points

Related Questions In Puppet

0 votes
1 answer
0 votes
1 answer

Puppet+Kubernetes: Is there a way to create resources in Kubernetes using Puppet?

Yes, it is quite possible to create ...READ MORE

answered Aug 23, 2019 in Puppet by Sirajul
• 59,230 points
977 views
0 votes
1 answer

Service already defines error in Puppet

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

answered Feb 9, 2019 in Puppet by Monish
1,119 views
0 votes
1 answer

What are profiles in Puppet?

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

answered Feb 15, 2019 in Puppet by Sheela
633 views
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,035 views
+2 votes
1 answer
0 votes
1 answer

what are Resources in puppet?

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

answered Jul 24, 2019 in Puppet by Sirajul
• 59,230 points
679 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, 2019 in Puppet by Sirajul
• 59,230 points
638 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP