Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Chef Tutorials: Chef in-built and common resource types with example

  • package: Used to manage packages on a node
  • service: Used to manage services on a node
  • user: Manage users on the node
  • group: Manage groups
  • template: Manage files with embedded ruby templates
  • cookbook_file: Transfer files from the files subdirectory in the cookbook to a location on the node
  • file: Manage contents of a file on node
  • directory: Manage directories on node
  • execute: Execute a command on the node. Use the script resource to execute a script using a specific interpreter (Ruby, Python, Perl, csh, or Bash).
  • cron: Edit an existing cron file on the node
  • bash: Use the bash resource to execute scripts using the Bash interpreter.
  • log: A log resource block adds messages to the log file based on events that occur during a Chef Infra Client run:

Bash vs execute

For a single script, use an execute. The bash resource is for including the script contents inline in the recipe code.

Use the bash resource to execute scripts using the Bash interpreter. Commands that are executed with this resource are (by their nature) not idempotent, as they are typically unique to the environment in which they are run.

Use the execute resource to execute a single command. Commands that are executed with this resource are (by their nature) not idempotent, as they are typically unique to the environment in which they are run.Use the script resource to execute a script using a specific interpreter (Ruby, Python, Perl, csh, or Bash).

Chef in-built and common resource types

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x