Hi guys,
How can I use the set variable value in a playbook I created in a different playbook?
Solved! Go to Solution.
Nominating a forum post submits a request to create a new Knowledge Article based on the forum post topic. Please ensure your nomination includes a solution within the reply.
Hello Adem_netsys,
The most common way this is done is by adding a parameter to your referenced (child ) playbook via Tools > Parameters. Then you are able to pass specific variables to that playbook
When you call the child/reference playbook from the parent playbook, you are able to insert variables into the new parameter
Then back in the child playbook you can use the parameter
When we run the playbook we can confirm that the variable was passed.
I've attached this playbook to my comment so feel free to give it a try. Hope this helps!
Created on 08-25-2023 05:38 AM
Thanks for reaching out, please help share some more info, so that we can facilitate your ask.
I have one playbook and it has a set variable value in it. I want to use this variable value in different playbooks.
I think you need to expand on the use case. i.e. What's the use case for the playbooks? Why do you need to pass that data stored in the variable into another playbook?
To my knowledge, the only way that you could use that variable's value in another playbook, is if that playbook then calls another playbook (via referencing), and passes that variable into the referenced playbook.
An alternative is it to pass the value of that variable into a global variable, or to store the data in a custom module, but I probably wouldn't recommend those without knowing the use case.
for example, when an alarm occurs on a device, I assign the alarm id to a varible value and connect to the device with ssh and run a command, and I need to do this in different playbooks, but it doesn't seem practical to add it manually all the time. I also thought about assigning a global value, I was curious about a different method.
The best method would probably be to use the playbook reference method, as detailed by Dylan further down. The workflow would probably be something along the lines of:
If the data in the variable is only linked to that Alert, then another possible way would be to store the information in a field in the Alert. You could use an unused field for that Alert type, or you could modify the Alert module to include a custom field which you use for only that purpose.
Created on 08-25-2023 05:52 AM Edited on 08-25-2023 06:01 AM
Thank you so much @swolf and adem_netsys for your prompt reply.
In addition, please see Playbooks Guide https://docs.fortinet.com/document/fortisoar/7.4.1/playbooks-guide/331279/introduction-to-playbooks#...
Feel free to add on more details and our experts will pitch in.
Hello Adem_netsys,
The most common way this is done is by adding a parameter to your referenced (child ) playbook via Tools > Parameters. Then you are able to pass specific variables to that playbook
When you call the child/reference playbook from the parent playbook, you are able to insert variables into the new parameter
Then back in the child playbook you can use the parameter
When we run the playbook we can confirm that the variable was passed.
I've attached this playbook to my comment so feel free to give it a try. Hope this helps!
Hi Dylan,
First of all, thank you very much for your concern. What is the difference between creating a global variable and giving a parameter?
As name suggests Global Variable is global at FortiSOAR instance and it will be accessible and used by any playbook in the instance. Whereas parameter is local to that specific PB instance.
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2024 Fortinet, Inc. All Rights Reserved.