Table of contents
1.
Introduction
2.
About Chef Desktop
3.
Windows Disk Encryption
4.
windows_disk_encryption Resource
4.1.
Syntax
5.
Actions of windows_disk_encryption Resource
6.
Properties of windows_disk_encryption Resource
7.
Common Resource Functionality
7.1.
Common Properties
7.2.
Notifications
7.3.
Guards
8.
Examples
8.1.
Enable BitLocker
9.
Frequently Asked Questions
9.1.
Does Chef have a Graphical User Interface?
9.2.
What do you understand about a node in Chef?
9.3.
What do you mean by an attribute in Chef?
9.4.
What are the three main components of chef?
9.5.
What do you mean by a client in chef?
10.
Conclusion
Last Updated: Mar 27, 2024
Medium

CHEF- RESOURCES -windows_disk_encryption Resource

Author Amit Singh
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Have you ever tried to automate the management of the servers and network equipment in your organization using any software or tool?

chef

This article is focused on one of the automation software, which is known as chef. We will also study one of the Chef Resources, which is known as the windows_disk_encryption Resource, in detail. We will also learn about syntax and properties as well. Let’s see all these things in more detail.

About Chef Desktop

chef

Chef Desktop can be understood as a deployment strategy. It uses programming to automate the management of desktop and laptop computers. Chef curated Desktop content with YAML support to construct device profiles. Then you can audit it using Chef curated Desktop CIS profiles. After the audit, you can deploy it with Chef Infra. Chef Automate can also be used to provide continuous insight into the fleet’s configuration state.

Windows Disk Encryption

bitlocker

Encryption is the process of transforming any information into a secret code. The science of encryption and decryption of information is known as cryptography. In computer science, unencrypted information is called plaintext. And the encrypted information is known as ciphertext.

Encryption protects your information. It ensures that only those with the proper permissions can access your device's data. In Windows devices, a feature provided to you to accomplish encryption is known as BitLocker. You might be able to activate basic BitLocker encryption even if the device encryption is not available on your device.

windows_disk_encryption Resource

In Chef Desktop, we can use the windows_disk_encryption resource to enable or disable the feature known as the Bitlocker. It is a Drive Encryption System on Windows Systems. 

It is a newly added feature of Chef Desktop 1.0.

Syntax

syntax

There are many properties that are available to the windows_disk_encryption resource. Following is the complete syntax for all these properties:

windows_disk_encryption 'name' do
  reboot_after_update      true, false # default value: true
  action                   Symbol # defaults to :enable if not specified
end

In the above syntax,

  • The resource name is windows_disk_encryption.
     
  • The name of the resource block is given using the name.
     
  • The steps taken by Chef Infra Client to bring the node into the required state are identified by action.
     
  • ireboot_after_update is the property that is available to the resource.

Actions of windows_disk_encryption Resource

actions

Following are the actions that the windows_disk_encryption resource has:

  • :disable: It is used to turn off the BitLocker.
     
  • :enable: It is used to turn on the BitLocker.
     
  • :nothing: This resource block will not act unless it is notified by any other resource to take action. Once it has been notified, this resource block will either run immediately or will be queued up to run at the end of a Chef Infra Client run.

Properties of windows_disk_encryption Resource

Following are the properties that the windows_disk_encryption resource has:

  • reboot_after_update: It is used to control the behavior after you have enabled BitLocker. Ruby Type is true, false.

Common Resource Functionality

Chef resources also include some common properties, notifications, and resource guards.

Common Properties

Following are the properties that are common to every resource:

  • compile_time: It controls the phase during which the resource is run on the node. We can set it to “true” to run while the resource collection is being created (the compile phase). We can set it to “false” to run while Chef Infra Client is working on the node configuration (the converge phase).
     
  • ignore_failure: It helps in running a recipe even if a resource has failed for any reason. :quiet will not show the full stack trace. As a result, the recipe will continue to run even if a resource fails.
     
  • retries: It is the number of attempts to catch an exception and retry the resource.
     
  • retry_delay: It is the delay in seconds between the retry attempts.
     
  • sensitive: It ensures that sensitive resource data is not logged by Chef Infra Client.

Notifications

notifications
  • notifies: When one resource's state changes, it may notify another resource to take appropriate action. A resource can notify multiple resources. It uses a “notifies” statement for each resource that has to be notified.
     
  • subscribes: If the status of the resource being listened to changes, the resource that is listening may take action after doing so.
timer

A timer is used to specify the point during a Chef Infra Client run at which a notification will run. The following timers are available:

  • :before: It specifies that the action on a notified resource must run before processing the resource block in which the notification is present.
     
  • :delayed: It specifies that a notification should be queued up and then executed at the end of a Chef Infra Client run.
     
  • :immediate, :immediately: It specifies that a notification should run immediately for each resource that has been notified.

Guards

guard

When a Chef Infra Client run is executed, a node's state can be assessed using a guard property. Depending on these results, a guard property is then used to inform the Chef Infra Client whether it should carry out a resource's execution further. A Ruby block value or a string value can be used to specify a guard property:
 

Properties

  • not_if: It prevents a resource from executing when the condition returns true.
     
  • only_if: It allows a resource to execute only if the condition returns true.

Examples

example

The following examples demonstrate various approaches for using the windows_disk_encryption resource in recipes:

Enable BitLocker

disk_encryption 'Turns on BitLocker Drive Encryption' do
  action :enable
  reboot_after_update true
end

Frequently Asked Questions

Does Chef have a Graphical User Interface?

Chef is actually written in Ruby and Erlang, and it uses a pure-Ruby DSL in the Knife CLI. It also includes a nice GUI for easy management.

What do you understand about a node in Chef?

A node can be understood as any machine that is currently being managed by the Chef server. It can be attached to any network that can send and receive information.

What do you mean by an attribute in Chef?

An attribute is a piece of basic information about a specific node. It basically shows the state of the node.

What are the three main components of chef?

Workstations, servers, and nodes are the three main components of chef.

What do you mean by a client in chef?

On each node that Chef is responsible for managing, an agent called a chef-client runs locally.

Conclusion

In this article, we have studied one of the Chef Resources, which is known as the windows_disk_encryption Resource, in detail.

We hope that this article has provided you with the help to enhance your knowledge regarding the windows_disk_encyption Resource and if you would like to learn more, check out our articles on Chef migration and Chef Desktop.

Refer to our guided paths on Coding Ninjas Studio to learn more about DSA, Competitive Programming, JavaScript, System Design, etc. Enroll in our courses and refer to the mock test and problems available; take a look at the interview experiences and interview bundle for placement preparations.

Do upvote our blog to help other ninjas grow.

Merry Learning!

Live masterclass