InterviewSolution
Saved Bookmarks
| 1. |
What are resources? How do you handle system resources in Puppet? |
|
Answer» System resources are the key elements of a Puppet code that defines the architecture and manages the configuration of a system infrastructure.
Here is how a resource is written: resource_type { ‘resource_name’: attribute => value, attribute => value, … }
Example: user { ‘Jack’: ensure => present, owner => ‘root', group => ‘home’, mode => 0644, shell => ‘/bin/bash’ }This code evaluates as: These attributes have the respective values. We can get a list of all the available resource types with the command:
Some of the common resource types are:
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 } |
|