Table of contents
1.
Introduction 
2.
ServiceNow Integration App
2.1.
Prerequisites
2.1.1.
User requirements
2.1.2.
System Requirements
2.1.3.
Required ServiceNow Plugins
2.2.
Creating a data feed in Chef Automate
2.3.
Create a Connection from ServiceNow
2.4.
Automate Instances Module
2.4.1.
Chef Automate Settings
2.5.
Uninstall
3.
ServiceNow Incident App
3.1.
Key feaures of the Incident App
3.2.
User requirements
3.2.1.
System Requirements
3.3.
Setup
3.4.
Chef Infra Client Incidents
3.5.
Properties
3.6.
Incident App Properties
3.6.1.
x_chef_incident.association
3.6.2.
x_chef_incident.scan_association
3.6.3.
x_chef_incident.assigned_to
3.6.4.
x_chef_incident.assignment_group
3.6.5.
x_chef_incident.impact
3.6.6.
x_chef_incident_urgency
3.6.7.
x_chef_incident.retention_days
3.6.8.
x_chef_incident.logging.enabled
3.6.9.
x_chef_incident.logging.verbosity
3.7.
Uninstall
4.
ServiceNow Administrator Reference
4.1.
Integration App
4.1.1.
Events
4.1.2.
Scripts
4.1.3.
Scripted REST API
4.1.4.
Transform Map Scripts
4.2.
Incident App roles
4.2.1.
Role x_chef_inident.admin
4.2.2.
Role x_chef_incident.user
4.2.3.
Role x_chef_incident.api
5.
Frequently Asked Questions
5.1.
At which port is the ServiceNow instance reachable?
5.2.
What is the default value for feed_interval in the Chef Automate Setting?
5.3.
How many Application Properties are configurable in Chef Automate Incident App?
6.
Conclusion
Last Updated: Mar 27, 2024

Chef Integration

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction 

It is an open-source framework that is used for testing and auditing applications and infrastructure. It works by comparing the actual state of the system with the desired state, which is expressed in easy-to-read and easy-to-write Ched InSpec code. It is also capable of detecting violations and displays the findings in the form of a report. It gives users the control of remediation of the detected violations.

Chef Integration

ServiceNow Integration App

ServiceNow specializes in IT service management applications and provides forms-based workflow application development. It also provides cloud-based services that automate enterprise IT operations. Configuration management, incident management, and problem management are some of the most common integrations. Integration App is the Chef automate integration App for ServiceNow. After the app has been installed and configured, the integration allows Chef Automate to create as well as update a ServiceNow Configuration Management Database with data from nodes that Chef Automate manages.

The app works by exposing the REST API endpoints for communication purposes between Chef Automate and ServiceNow.

Prerequisites

The requirements for ServiceNow integration app are mentioned below:

User requirements

  • The user should have a unique ServiceNow URL, it is of the following mentioned format: https://ven12345.service-now.com.
  • After the integration app requires the x_chef_automate.api role to configure it. The ServiceNow administrator can now enable this for the user.


System Requirements

  • The system needs to have a running Chef Automate instance
  • The Chef Automate needs to have a valid SSL/TTL certificate from a trusted CA.
  • The system needs to have a running ServiceNow instance.
  • Port 443 is to reach the ServiceNow instance.


Required ServiceNow Plugins

The user can download the below-mentioned ServiceNow plugins from the Service Management dashboard:

  • System Import Sets com.glide.system_import_set, version 1.0.0 or higher.
  • CMDB 1.1
  • Configuration Management for Scoped Apps 1.0.0.

Creating a data feed in Chef Automate

The user can create a data feed in order to send data from the Chef Automate:

  • The user needs to confirm that the user has x_chef_automate.api role.
  • Go to Settings > Data Feeds > Create Data Feed.
  • Select
    • Name: Given a unique name for this integration.
    • Data Feed URL: The API addresses that the notification uses.
    • Username: The name which the user would use to sign in to ServiceNow.
    • Password: The password which the user would use to sign in to ServiceNow.
  • Then select Test Data Feed. If a test is successful, it will display service-now automate connectivity passed, or it returns a message along with the information for the connectivity or credentials issues to help the user resolve the error.
  • Click on Create Data Feed to save the setup.

Create a Connection from ServiceNow

Using the below-mentioned steps to connect the Integration App to Chef Automate:

  • The user needs to confirm that the user has x_chef_automate.api role.
  • Then navigate to the ServiceNow instance.
  • The user then needs to locate the Chef Automate from the Seach bar.
  • Choose the Automate Instances module.
  • Click on the New button.
  • Enter the below-mentioned details:
    • Name: Give a unique name for this integration.
    • Instance URL: The Chef Automate URL.
    • Automate API token: it is a chef automate API token which has data-feed-service authorization.
    • ServiceNow user: it is the name that the user uses to sign in to ServiceNow.
    • ServiceNow password: it is the password that the user uses to sign in to ServiceNow.
  • Click on the Test Connectivity button. The integration App will then check if the values are correct and then it will test the connection with Chef Automate.
  • Click on Submit. The ServiceNow app creates the Chef Automate instance detail.

Automate Instances Module

The user can configure the Integration App using either ServiceNow or Chef Automate. Change Integration App Properties in ServiceNow

  • In ServiceNow, find Chef Automate.
  • Choose the Chef Automate > Properties from the left navigation pane in order to open the Chef Automate Properties.
  • Make the required changes
  • Click on Save.


Chef Automate Settings

feed_interval
It represents the frequency of refreshing the data feed in hours. Since the duration between data feed refreshes is proportional to the node count, therefore more nodes are required for higher settings. Any integer between 2 to 8 is a valid value for this setting. The default value is 4.

node_batch_size
It represents the testing executed for a benchmark. The size of a compliance scan is directly proportional to the number of profiles applied. The user should use a lower node_batch_size setting in order to reduce the number of profiles applied in a single batch. Any value between 1 to 30 is a valid value. The default value is 15.

Uninstall

Follow the below steps to uninstall the Integration App:

  • Go to System Applications > Applications in ServiceNow.
  • Open the Downloads tab and choose the Chef Automate Incident Creation.
  • Go to Related Links.
  • Click on Uninstall.

ServiceNow Incident App

The Incident App is responsible for generating incidents in the ServiceNow Incident Management environment for either configuration run or compliance check features in Chef Automate. This helps the user to capture the failures in the automated infrastructure and to improve incident tracking and resolution.

ServiceNow Incident App

Key feaures of the Incident App

  • It provides incident management for infrastructure and compliance automation.
  • It provides intelligent data management and event de-duplication.
  • It also has compliance-related integrations within ServiceNow.


Since the incident app generates a data stream of compliance events that the user can leverage by using this data for other ServiceNow applications. The user can personalize the Chef Automate compliance data stream by prioritizing the scan results, which helps the user to enhance their risk dashboard with real-time and ranked compliance.

User requirements

  • The user should have a unique ServiceNow URL, it is of the following mentioned format: https://ven12345.service-now.com.
  • After the integration app requires the x_chef_automate.api role to configure it. The ServiceNow administrator can now enable this for the user.


System Requirements

The system should have an integration App already installed and configured.

Setup

The user can set up automatic incident creation for:

  • Chef Infra Client failures
  • Chef InSpec scan failures

Chef Infra Client Incidents

Follow the below steps if you want to set up automatic incident reporting for any failed Chef Infra Client runs from the Chef Automate:

  • The user needs to confirm the x_chef_automate.api role.
  • Go to Settings > Notifications.
  • Choose to Create Notifications.
  • Enter the following details:
    • Name: Give a unique name to this notification.
    • Webhook Type: it represents the product or the process that is receiving the notification.
    • Failure Type: it is the Chef process for the notification.
    • ServiceNow user: it is the name that the user uses to sign in to ServiceNow.
    • ServiceNow password: it is the password that the user uses to sign in to ServiceNow.
  • Click on the Test Connectivity button. If the test is successful, it displays the Notification test connected successfully, or it displays a message along with information about any connection or credentials problems to help the user fix the error.
  • Click on Create Notification in order to save this notification.

Properties

There are nine configurable Application Properties in Chef Automate Incident App. The user needs to have either admin or x_chef_incident.admin role in order to change their default values.

In order to change the Incident App properties:

  • In ServiceNow, find the Chef Incidents
  • Choose Chef Incidents > Properties from the navigation.
  • Make the necessary changes in the Chef Incident Properties form.
  • Click on Save.

Incident App Properties

x_chef_incident.association

It is used to associate the Chef Infra Client run record with an Incident record. The default for this property is cookbook, other possible value is node. The cookbook is the default value as the number of nodes exceeds the number of cookbooks in any system. By setting the value to cookbook, it creates an incident for cookbook creates a failed cookbook. By setting the value to node, it creates an incident for each failed node.

x_chef_incident.scan_association

It associates a Chef InSpec scan record with an incident record. The default value for this property is profile, other possible value is node. The profile is the default value as the number of nodes exceeds the number of profiles. By setting the value to profile, it creates a Chef Inspec compliance scan incident. By setting the value to node, it creates an incident for each failed node.

x_chef_incident.assigned_to

It assigns a ServiceNow user ID to the incidents. If in case the user is a part of the group, then that particular group will be automatically assigned to the incident. The default value for the x_chef_incident.assigned_to property is set to none.

x_chef_incident.assignment_group

It assigns a group to the incident rather than assigning it to an individual user in the x_chef_incident.assigned_to property. The default value for the x_chef_incident.assignment_group property is blank.

x_chef_incident.impact

It sets an incident impact value. The default value for the x_chef_incident.impact property is 2, other values are 1 and 3.

x_chef_incident_urgency

It sets an incident urgency value. The default value for the x_chef_incident_urgency property is 2, other values are 1 and 3.

x_chef_incident.retention_days

It defines the number of days that are required to retain Chef Infra Client run and Chef InSpec scan reports in ServiceNow. The ServiceNow app can automatically update the records associated with reports whenever they get closed, deleted, or removed. The default value for the x_chef_incident.retention_days property is 30.

x_chef_incident.logging.enabled

The property should be set to Yes if the user wants to enable logging and No if the user wants to disable it. Once the property is enabled, the authorized users can view the logs at Chef Incidents > Logs and System Logs > Application logs. The default value for the x_chef_incident.logging.enabled property is No.

x_chef_incident.logging.verbosity

It sets the amount of information that is visible in logs. The default value for the x_chef_incident.logging.verbosity property is an error, the other possible values are debug, war, and info.

Uninstall

Follow the below steps to uninstall the Chef Automate Incident App:

  • Go to System Applications > Applications in ServiceNow.
  • Open the Downloads tab and choose the Chef Automate Incident Creation.
  • Go to Related Links.
  • Click on Uninstall.

ServiceNow Administrator Reference

The user can find the Chef Automate features in the ServiceNow instance by searching Chef in the Filter Navigator.

Integration App

Events

The user needs to go to the Events section by selecting Chef Automate > Events from ServiceNow.

x_chef_automate.chef.process.data
It is triggered when ServiceNow receives nodes data from the terminal or the app.

x_chef_automate.chef.process.installation
It is triggered when the asset import table receives software installation details in order to map in the CMDB server table.

Scripts

Script Actions
The user needs to go to the Script Actions section by selecting Chef Automate > Script Actions from ServiceNow.

  • The Asset Process script action processes the events as well as updates the node data into the asset import table.
  • The Process Software Instance script action processes the events as well as updates the software installation data in the CMDB server table.


Script Includes
The user can go to the Script Includes section by selecting Chef Automate > Script Includes from ServiceNow.

  • AutomateApi
    It calls the Chef Automate API and also checks for the status of the response.
  • AutomateApiClient
    It updates the token as well as the password in the Chef Automate Instance.
  • BufferToImportUtil
    It is used to update the CPU speed in the Linux Server, CMDB Server, CMDB OSX server, and also CMDB win server.
  • JsonUtil
    It updates the JSON objects
  • Logger
    It updates the logging status to either enabled or disabled.


Scripted REST API

It aids in establishing a connection between ServiceNow and the Chef Automate application with authentication. The user can go to this section by selecting Chef Automate > Script Rest API from ServiceNow.

Transform Map Scripts

The transformation events occur when an import set table is transformed into a target table.

On Before
Mapping manufacturer, CPU manufacturer, model category, and model by using this script.

On After
The five On After scripts that are required in order to update the values are:

  • Update the values: node id, node name, organization, and IP address, and then insert the record into the Chef Automate client run cookbooks, Chef Automate client run recipes and Chef Automate client run lists.
  • Update the software, name, and install the CMDB software instance table.
  • Update the data in the cmdb_ci_spkg table and the cmdb_software_instable table.
  • Either insert or update the data in the cmdb_cli_file_system table.
  • Either insert or update the data in the cmdb_ci_network_adapter table.

Incident App roles

The user can associate a single user with more than one role.

Role x_chef_inident.admin

The user can assign the x_chef_incident.admin role to any user other than the System Administrator in order to allow another user to manage the application properties and logs. The System Administrator authorization also has access to the tasks in the Admin role. The Admin grants the user access to the Chef incidents menu, Client, runs menu item, Support menu item, Logs menu item, etc.

Role x_chef_incident.user

This role is for those users who require application access without any administrative rights. The role grants the user access to the Chef incidents menu, Chef InSpec scans menu items, etc.

Role x_chef_incident.api

This role is suitable for users responsible for integrating the Chef Automate data into ServiceNow. It is advised to create a new user specifically for this role. The Chef Automate Incident App requires the API role to set up communication with the Chef Automate.

Frequently Asked Questions

At which port is the ServiceNow instance reachable?

At Port 443 is to reach the ServiceNow instance.

What is the default value for feed_interval in the Chef Automate Setting?

The default value for feed_interval is 4.

How many Application Properties are configurable in Chef Automate Incident App?

There are nine configurable Application Properties in Chef Automate Incident App. 

Conclusion

In this article, we have extensively discussed about Chef-Integration.

After reading about the various Profiles in Chef InSpec, are you not feeling excited to read/explore more articles on Configuration Management? Don't worry; Coding Ninjas has you covered. To learn about what ansible iswhat is ansible YAML syntax and how errors are handled in the ansible playbook

If you wish to enhance your skills in Data Structures and AlgorithmsCompetitive ProgrammingJavaScript, etc., you should check out our Guided path column at Coding Ninjas Studio. We at Coding Ninjas Studio organize many contests in which you can participate. You can also prepare for the contests and test your coding skills by giving the mock test series available. In case you have just started the learning process, and your dream is to crack major tech giants like Amazon, Microsoft, etc., then you should check out the most frequently asked problems and the interview experiences of your seniors that will surely help you in landing a job in your dream company. 

Do upvote if you find the blogs helpful.

Happy Learning!

Thank you

Live masterclass