RUN-BOOK AUTOMATION : INTERMEDIATE GUIDE
Please make sure you have read the RunBook Orchestrator, RunBook Concepts, & Basic Guide sections, before proceeding with this sub-section.
In this section, we will get into more details about following different topic :
- Sharing Data across RunBook Steps at Run-time
Sharing Data across RunBook Steps at Run-time
RunBook Orchestrator provides a very easy way for sharing data across the different steps during run-book execution.
This is a pretty powerful feature, especially when the steps are to be executed on different servers.
Let's take a simple example where we have a run-book with 2 steps - Step 1 & Step 2. Each of the steps will be run on a different server - S1 & S2, and we want to share 2 properties that will be generated by code executing step 1, with the code to be executed in step 2. Now since, each of the step, will be running on different server, user needs a way for sharing the data across steps.
Figure below illustrates the data sharing requirement across 2 steps in an easy to understand style:
DivineCloud provides a very easy way to achieve this using a feature called Generated Properties.
User can specify a text file that will contain all the shared properties to the run-book, and this data will be made available to the code in every step just like any other property.
User will need to perform following steps to be able to share data across steps:
- 1. Open the RunBook Properties form and provide the generated properties file path. The value should match with the file path that step 1 will write the proeprties to.
- 2. Code for Step 1, should ensure all the properties that need to be shared are written to the file as specified above.
- 3. Open Step 2 Properties form, and select the "Apply Properties" Checkbox
- 4. Code for Step 2, can now refer to the shared properties that will be generated by code in step 1. During run-book execution those properties will get replaced with appropriate values.
- 5. Execute the run-book
Figure below shows the sample run-book that demonstrates approach for sharing data across steps:
It's important to notice how the value of the properties - $SHARED_VAR_1 & _SHARED_VAR_2_ , were set by Step 1 code in server 1, and were made automatically available to Step 2 code in Server 2 during run-book execution.
Another important point to notice, is that the language for the two steps are different. Step 1 is written in Shell Script and Step 2 is written in PERL, yet, the data generated by code in Step 1 is accessible by code in Step 2. The Steps could be written in any language and can still share the data with each other during run-book execution without any problem.
Same is true for the number of servers. Even though the above example has just 2 servers, the logic applies even if there were 200 servers instead of 2 servers for each of the above steps.