Jenkins Freestyle Integration with Ansible and Hivel Webhook
This guide walks you through integrating Jenkins Freestyle pipelines with Hivel using an Ansible playbook and webhook reporting. You’ll learn how to trigger a playbook, capture build and stage metadata, and send it to Hivel’s API endpoint for monitoring and analytics.
🧰 Prerequisites
Make sure the following are set up on your Jenkins server (typically an EC2 instance):
✅ Jenkins installed and accessible
✅ Admin access to Jenkins UI
✅ Ansible installed and available in PATH
✅ Git configured (for Git metadata collection)
📦 Required Plugin
Install the following plugin:
Plugin Name
Description
Allows running Groovy scripts after a build
Required Credentials for Integration
During the integration, you'll need:
Organization ID (Generated in the Hivel application)
API Key (Generated in the Hivel application)
Retrieving Your Organization ID and API Key
Open the Hivel application and navigate to Integrations under the Settings.
Locate the Jenkins Integration card and click Connect.
Follow the given steps to start your integration.
By clicking on generate your Organization ID and API Key will be generated.
Use these fields while integrating with Jenkins. The steps for where to apply them are provided on the following page.
Configuring Credentials in Jenkins
Log in to your Jenkins application.
From the side navigation, select Manage Jenkins.
Click on Credentials.
Click on global under Stores scoped to Jenkins
Choose Add Credentials - you will need to do this twice (once for the Organization ID and once for the API Key).
From the dropdown, select Secret text.
After selecting Secret text from the dropdown, fill in the details twice as follows:
Adding the API Key
ID: hivel-jenkins-api-key
Secret: {your API key} (copied from Hivel)
Description: This is the Jenkins API key from Hivel
Click Save
Repeat the process again for Adding the Organization ID
ID: hivel-org-id
Secret: {your Organization ID} (copied from Hivel)
Description: This is the Jenkins Organization ID from Hivel
Click Save
Once you have completed the above steps, your Jenkins Global Credentials should display the following entries:
Step 2: Bind Secrets in Job Configuration
Open your Freestyle job(pipeline in your dashboards)
Go to the Environment section
Check Use secret text(s) or file(s)
Click Add and bind the credentials like this:
Variable Name
Credentials ID
HIVEL_ORG_ID
hivel-org-id
HIVEL_JENKINS_API_KEY
hivel-jenkins-api-key
Step 3: Install Ansible on Jenkins Server
Ensure Ansible is installed on the EC2/server where Jenkins is hosted.
Output is saved in JSON format to ansible-output.json
Even on errors, the script doesn’t fail the job
Note : replace the path of your ansible file with “ansible/dummy-stages.yml”. Invoking ansible like this will only help us to get insights from ansible playbook.
Step 5: Add Groovy Postbuild Script for Webhook Reporting
Under Post-build Actions:
Add → Groovy Postbuild
Uncheck the box labeled Use Groovy Sandbox
Approve script (open will appear once you enter script in groovy text box)
Save the job
if you check “use groovy sandbox” you might require to allow all script to be executed from settings section : go to Manage Jenkins → In-process Script Approval and approve the pending script.