Passing payload data from rulebook to run_job_template?

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.

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.

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.

1 Like

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

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)

ansible-rulebook.yml

- 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

- 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