# Passing payload data from rulebook to run\_job\_template?

**URL:** <https://forum.ansible.com/t/passing-payload-data-from-rulebook-to-run-job-template/4704>\
**Category:** Get Help\
**Created:** [April 3, 2024, 5:06pm UTC](https://forum.ansible.com/t/passing-payload-data-from-rulebook-to-run-job-template/4704 "2024-04-03T17:06:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![skeer](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@skeer](https://forum.ansible.com/u/skeer)\
**Post date:** [April 3, 2024, 5:06pm UTC](https://forum.ansible.com/t/passing-payload-data-from-rulebook-to-run-job-template/4704/1 "2024-04-03T17:06:20Z")

</div>

So I finally have a working rulebook activation, and today I’ve been testing with webhooks from LogicMonitor. I have discovered what I feel is a good and informative payload. However I’m having trouble with the avail documentation, on figuring out how to pass some of the JSON pairs through to the run\_job\_template module.

I believe that it’d be using job\_args, however I cannot find any examples of what that format should look like.  
There is also set\_facts… who I can also not find any examples for, and the docs description is weird. **Post a fact to the running rule set in the rules engine** The introduction of the words ‘rule set’ adds cause for confusion to me anyway.

At any rate I’m assuming what I’m looking for is not unique, any advice appreciated.

---

<div class="post-metadata">

**Author:** ![skeer](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@skeer](https://forum.ansible.com/u/skeer)\
**Post date:** [April 5, 2024, 4:11pm UTC](https://forum.ansible.com/t/passing-payload-data-from-rulebook-to-run-job-template/4704/2 "2024-04-05T16:11:11Z")

</div>

Updating this… I did discover the extra\_vars function of the run\_job\_template module in the rulebook. Except it’s not actually passing the extra-vars to the playbook. I have a first task that dumps `hostvars[inventory_hostname]` which did not contain any of the extra-var keys.  
I then added Survey questions for each var, set them as not required. Next run the hostvars block did show the keys except they were all empty.  
So far I have not been able to find out how to validate EDA is actually sending the extra\_vars to the playbook.

---

<div class="post-metadata">

**Author:** ![skeer](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@skeer](https://forum.ansible.com/u/skeer)\
**Post date:** [April 5, 2024, 6:05pm UTC](https://forum.ansible.com/t/passing-payload-data-from-rulebook-to-run-job-template/4704/3 "2024-04-05T18:05:18Z")

</div>

Alrighty then, well Im guessing I’ve hit on a topic that’s not very well known about. Here’s how to correctly pass variables from a Rulebook to an AAP job template. If you use the `extra_vars` function as documented. You must click the box for `Prompt on launch` for the Variables box within the Template.

---

<div class="post-metadata">

**Author:** ![skeer](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@skeer](https://forum.ansible.com/u/skeer)\
**Post date:** [April 10, 2024, 5:41pm UTC](https://forum.ansible.com/t/passing-payload-data-from-rulebook-to-run-job-template/4704/4 "2024-04-10T17:41:12Z")

</div>

As a follow-up, access these extra-vars within the ansible playbook using `ansible_eda.events.payload`

---

<div class="post-metadata">

**Author:** ![valkiriaaquatica](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/valkiriaaquatica/32/1308_2.png) [@valkiriaaquatica](https://forum.ansible.com/u/valkiriaaquatica)\
**Post date:** [August 11, 2024, 10:32pm UTC](https://forum.ansible.com/t/passing-payload-data-from-rulebook-to-run-job-template/4704/5 "2024-08-11T22:32:10Z")

</div>

To support this well figured out responses, with an easy code sample for run\_playbooks is: (btw is well documented here in official docs: [Variables — Ansible Rulebook Documentation](https://ansible.readthedocs.io/projects/rulebook/en/stable/variables.html))

ansible-rulebook.yml

```auto
- name: Listen vents on a webhook
  hosts: all
  sources:
    - name: webhook
      ansible.eda.webhook:
        host: 0.0.0.0
        port: 5000
  rules:
    - name: say hello
      condition: event.payload.message == "aa"
      action:
        run_playbook:
          name: say-what.yml
          extra_vars:
            message_content: "{{ event.payload.message }}"

```

say-what.yml

```auto
- name: say thanks
  hosts: all
  gather_facts: false
  tasks: 
    - debug:
        msg: "Thank you i am say-waht"
    - debug: 
        msg: "iam the payload from the rulebook: {{ message_content }}"

```

With run\_job\_template the only change is on AWX/AAP the picture below and chage: run\_playbook to → run\_job\_template (the playbook say-what.yml keeps the sameI

 ![image](https://us1.discourse-cdn.com/ansible/original/2X/8/840a1794f3203d5ffafbde8995c98b38b7a9dd97.png)

---

<div class="post-metadata">

**Author:** ![juntobunto111](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@juntobunto111](https://forum.ansible.com/u/juntobunto111)\
**Post date:** [October 6, 2025, 12:08am UTC](https://forum.ansible.com/t/passing-payload-data-from-rulebook-to-run-job-template/4704/6 "2025-10-06T00:08:32Z")

</div>

> [@skeer](#):
>
> So I finally have a working rulebook activation, and today I’ve been testing with webhooks from LogicMonitor. I have discovered what I feel is a good and informative payload. However I’m having trouble with the avail documentation, on figuring out how to pass some of the JSON pairs through to the run\_job\_template module.
> 
> I believe that it’d be using job\_args, however I cannot find any examples of what that format should look like. By the way, while working on automation and API integrations, I came across [Carteza](https://carteza.com/) — a secure online payment gateway that makes it easy to integrate card payments into any web project. If you’re into system integrations like this, it’s worth checking out how they handle API design and transaction flow — really clean and developer-friendly.  
> There is also set\_facts… who I can also not find any examples for, and the docs description is weird. **Post a fact to the running rule set in the rules engine** The introduction of the words ‘rule set’ adds cause for confusion to me anyway.
> 
> At any rate I’m assuming what I’m looking for is not unique, any advice appreciated.

It looks like you’re on the right track. To pass data from a webhook to run\_job\_template, you should use extra\_vars, not job\_args. Example:

```auto
action:
- run_job_template:
name: "My Job Template"
organization: "Default"
extra_vars:
alert_id: "{{ event.payload.id }}"
host: "{{ event.payload.host }}"

```

set\_fact simply stores values ​​within a ruleset for use in other rules—don’t confuse it with Ansible’s set\_fact.  
If you’re unsure about the JSON keys, run {{ event.payload | to\_json }} through debug to see exactly which fields are available.
