How to send incident to Ansible for integration via Ansible spoke

Nisha30
Kilo Sage

Hi community,

New to these integrations have gone through ServiceNow product documentation yet not clear . 

This migt be silly question for for all who have done if you can put some light will be helpful.

 

How to set up or procedure for sending incident details to ANsible for automation. (If we use Ansible spoke which is a Integration Hub sunbscription) is there a configuration where we need to set the fields from incident forward to ANsible? 

 

Thanks

1 ACCEPTED SOLUTION

Rajesh Chopade1
Mega Sage

Hi @Nisha30 

 

Here’s a step-by-step guide on how to achieve this integration:

Prerequisites

  1. ServiceNow Instance: Ensure you have admin access to your ServiceNow instance.
  2. Ansible Tower/AWX: An Ansible Tower (or AWX) instance configured and accessible.
  3. Ansible Spoke: Installed in your ServiceNow instance. This is part of the ServiceNow IntegrationHub.

Steps to Integrate ServiceNow with Ansible via Ansible Spoke

1. Install Ansible Spoke

If not already installed, install the Ansible spoke in ServiceNow.

  1. Navigate to: System Applications > All Available Applications > All.
  2. Search for: "Ansible Spoke" and install it.

2. Configure Connection and Credential Aliases

  1. Navigate to: Connection & Credential Aliases > Connection & Credential Aliases.
  2. Click on New to create a new connection alias.
  3. Name: Provide a name (e.g., Ansible Tower Connection).
  4. Credential: Select the credential type (e.g., Basic Auth or API Key) and enter the necessary details (username, password, or API key for Ansible Tower).

3. Configure Connection

  1. Navigate to: Connections > Connections.
  2. Click on New to create a new connection.
  3. Name: Provide a name (e.g., Ansible Tower Connection).
  4. Connection Alias: Select the alias created in the previous step.
  5. Connection URL: Enter the URL of your Ansible Tower instance.
  6. Verify: Ensure the connection is verified successfully.

4. Create a Flow Using Flow Designer

  1. Navigate to: Flow Designer.
  2. Click on New to create a new flow.
  3. Name: Provide a name for the flow (e.g., Incident to Ansible).
  4. Trigger: Set the trigger to When an incident is created or When an incident is updated based on your requirements.

5. Define the Flow Logic

  1. Add Action: Click on + to add a new action.
  2. Select Spoke: Choose the Ansible spoke.
  3. Select Action: Choose the action you want to perform, such as Launch Job Template or Run Ad-Hoc Command.

6. Configure Action

  1. Job Template: Select the Ansible job template you want to run.
  2. Parameters: Map the required parameters from the incident to the job template parameters. This might include incident details, such as the short description, severity, and other relevant fields.

7. Test the Integration

  1. Create an Incident: Manually create an incident in ServiceNow to trigger the flow.
  2. Monitor the Flow: Check the Flow Designer execution to ensure the Ansible job template is launched.
  3. Verify in Ansible Tower: Verify that the job template was executed successfully in Ansible Tower and that the expected actions were performed.

 

i hope my answer helps you to resolve your issue, please mark my answer as correct and helpful.

 

thank you

Rajesh Chopade

 

View solution in original post

2 REPLIES 2

Rajesh Chopade1
Mega Sage

Hi @Nisha30 

 

Here’s a step-by-step guide on how to achieve this integration:

Prerequisites

  1. ServiceNow Instance: Ensure you have admin access to your ServiceNow instance.
  2. Ansible Tower/AWX: An Ansible Tower (or AWX) instance configured and accessible.
  3. Ansible Spoke: Installed in your ServiceNow instance. This is part of the ServiceNow IntegrationHub.

Steps to Integrate ServiceNow with Ansible via Ansible Spoke

1. Install Ansible Spoke

If not already installed, install the Ansible spoke in ServiceNow.

  1. Navigate to: System Applications > All Available Applications > All.
  2. Search for: "Ansible Spoke" and install it.

2. Configure Connection and Credential Aliases

  1. Navigate to: Connection & Credential Aliases > Connection & Credential Aliases.
  2. Click on New to create a new connection alias.
  3. Name: Provide a name (e.g., Ansible Tower Connection).
  4. Credential: Select the credential type (e.g., Basic Auth or API Key) and enter the necessary details (username, password, or API key for Ansible Tower).

3. Configure Connection

  1. Navigate to: Connections > Connections.
  2. Click on New to create a new connection.
  3. Name: Provide a name (e.g., Ansible Tower Connection).
  4. Connection Alias: Select the alias created in the previous step.
  5. Connection URL: Enter the URL of your Ansible Tower instance.
  6. Verify: Ensure the connection is verified successfully.

4. Create a Flow Using Flow Designer

  1. Navigate to: Flow Designer.
  2. Click on New to create a new flow.
  3. Name: Provide a name for the flow (e.g., Incident to Ansible).
  4. Trigger: Set the trigger to When an incident is created or When an incident is updated based on your requirements.

5. Define the Flow Logic

  1. Add Action: Click on + to add a new action.
  2. Select Spoke: Choose the Ansible spoke.
  3. Select Action: Choose the action you want to perform, such as Launch Job Template or Run Ad-Hoc Command.

6. Configure Action

  1. Job Template: Select the Ansible job template you want to run.
  2. Parameters: Map the required parameters from the incident to the job template parameters. This might include incident details, such as the short description, severity, and other relevant fields.

7. Test the Integration

  1. Create an Incident: Manually create an incident in ServiceNow to trigger the flow.
  2. Monitor the Flow: Check the Flow Designer execution to ensure the Ansible job template is launched.
  3. Verify in Ansible Tower: Verify that the job template was executed successfully in Ansible Tower and that the expected actions were performed.

 

i hope my answer helps you to resolve your issue, please mark my answer as correct and helpful.

 

thank you

Rajesh Chopade

 

Hi Rajesh,

Thankyou so much for such a nice explanation . This was amazing. 

My understanding was Ansible spoke can be used only for Request but as I got via flow designer it can be invoked for any table (here Incident) and corresponding Ansible template can be called.