Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
Have you ever tried to automate the management of the servers and network equipment in your organization using any software or tool?
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 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
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
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
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
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.
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
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
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.