problem passing var between tasks.

I have a problem passing a variable between playbooks that are chained together. Any thoughts?

Playbook - audit_hardware_inventory.yml

Why two Playbook ?

But either way, Copy the Reg to a Local Json File

Then in your Second Playbook Just read in the JSON File

name: Read Json File
shell: cat Info.json
register: json_file

(json_file.stdout | from_json).VALUE

I simplified the playbook for the post. But, this specific call is used by many different playbooks. So instead of having to update each playbook if it changes, I want to abstract it out. Writing to a file seems a pretty crappy workaround. Is there not a way to pass variables between the playbooks directly?

Another way I know is to send the reg to the stdout and cat that stdout into the other playbook.
similar to outputting to the File, but if the API Value is big you may be better off with the Text File.

     register: test
   - debug: msg="{{test.stdout}}"

  tasks:
   - shell: cat "{{test.stdout}}"

can you try to pass the variable to include_tasks?

Reference: https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.7.html#include-tasks-import-tasks-inline-variables

-Suneel

Not tried yet, but this describes a dummy host:
https://stackoverflow.com/a/47811099/12731515

Suneel, I attempted your solution, but it didn’t work with the way I was setting up the workflow. Dick, I tried the Dummy host and it worked perfectly. Thank you for your responses.

Jeremy