RUN-BOOK AUTOMATION : ADVANCED GUIDE
Please make sure you have read the RunBook Orchestrator, RunBook Concepts, Basic Guide, & Intermediate Guide sections, before proceeding with this sub-section.
In this section, we will get into more details about following different topics :
- Dynamically Importing Nodes for RunBook Step Execution
- Power of RunBook Instance
Dynamically Importing Nodes for RunBook Step Execution
In situation, where the nodes on which some of the run-book step need to be executed on, are not known in advance, RunBook Orchestrator provides a way to dynamically add those nodes at run-time for executing specific steps. This is achieved by setting two attributes in run-book: Nodes Import Path & Dynamic Node Tag(s)
Let's take an example run-book with 2 steps. The 2nd step is to be executed on the node(s) which will be provisioned when the first step executes. Since the node does not exist yet, we cannot select it for step 2, prior to run-book execution. Solution to this is to set the following two attributes in the run-book.
- Dynamic Tag - Define a new dynamic tag for the step 2
- Nodes Import Path - Set the nodes import path to file, which will provide the new node(s) connection details
Once the above two attributes are set, at run-time during run-book execution, the node(s) list created in the nodes import file, will be used to run the step 2 against.
The node import file expects the node details to be provided in the following format:
HOST:22.214.171.124, ID:126.96.36.199, CREDENTIALS_NAME:aws_cred, DYNAMIC_TAGS:DTAG1, NAME:SampleInstance2, UNIQUE_ID:188.8.131.52, TEMP:Y
Figure below shows the sample run-book for dynamically importing nodes for run-book execution:
Figure below shows the step 2 being executed on two nodes, that were dynamically imported by code in step 1.
To import the nodes, step 1 code made two record entries in the node import file, one of each new node.
As shown in the figures above, following needs to be done for dynamic nodes import during run-book execution:
1. Define a Dynamic Tag (In the example above, the dynamic tag was DTAG1). To do that click the gear icon on the left of the Step that needs to be executed on dynamic nodes (In above example its step 2). Type DTAG1 next to "Dynamic Node Tags" label, and press enter.
2. Go to Step where the dynamic nodes will be added (In the above example it is step 1), and click the gear icon on the left of that step. Next to the "Nodes Import Path" label, Input the full path of the file where the node(s) details will be created in the format as suggested above.
3. Make sure the step for which the node import path was set, will generated the nodes list and write it to the nodes import file. In above example, the step 1, directly echo's the nodes details to the /tmp/nodes-import.txt file.
4. Now when the run-book is executed, the step 2 code will be executed on the nodes that were dynamically added in step 1.
Power of RunBook Instance
RunBook is a great way to encapsulate the overall orchestration code flow into a single text file. However, there are times,
when users would like to save the configuration details like Select Nodes for each steps, property values, etc. For example,
if a user is going to execute a run-book on same set of nodes, with same property values on regular basis, it would be great to be
able to capture all the configuration details and save it, so user does not have to re-type them everytime he executes that same run-book
on same set of nodes. To achieve this, RunBook Orchestrator provides option to save RunBook along with the configuration details. This saved
run-book along with configuration details (e.g. selected nodes per step, property values) is called RunBook Instance.
Figure below shows the screenshot for saving run-book as RunBook Instance :
RunBook Instance becomes a powerful enabler for One-click automation, as we would see in the section "one click deployments".
All the configuration details stored in RunBook Instance is encrypted, so important details like password, if present, is securely stored.