{"id":2571,"date":"2023-06-06T15:30:05","date_gmt":"2023-06-06T23:30:05","guid":{"rendered":"https:\/\/jetstreamsoft.com\/portal\/?post_type=ht_kb&#038;p=2571"},"modified":"2024-12-12T15:09:57","modified_gmt":"2024-12-12T23:09:57","slug":"runbook-scripts","status":"publish","type":"ht_kb","link":"https:\/\/jetstreamsoft.com\/portal\/jetstream-knowledge-base\/runbook-scripts\/","title":{"rendered":"Runbook Scripts"},"content":{"rendered":"\n<p class=\"is-style-info wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon\">This article applies to all JSDR software versions.<\/p>\n\n\n\n<p class=\"\">Changes can be made to Guest VMs after recovery by executing pre-scripts and post-scripts as part of runbook execution. Run-book scripts are custom scripts written in Python (.py) that can be created and applied by the user based upon their own specific requirements.<\/p>\n\n\n\n<p class=\"is-style-alert wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon\"><a href=\"https:\/\/jetstreamsoft.com\/portal\/online-docs\/jsdr-admin_4.2\/FailoverFailbackRunbooks.html\">Learn more about runbooks<\/a>.<br>Runbook scripts reside on and are executed from the <a href=\"https:\/\/jetstreamsoft.com\/portal\/online-docs\/jsdr-admin_4.2\/DeploytheManagementServerApplian.html\">management server (MSA)<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Steps to Execute Runbook Scripts<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"\">Log in to the MSA and create a <em>scripts <\/em>folder under <strong><kbd>vme2<\/kbd><\/strong> (<kbd>\/var\/lib\/vme2\/<\/kbd>).<\/li>\n\n\n\n<li class=\"\">Upload a pre-script and\/or post-script to the <em>scripts <\/em>folder.<\/li>\n\n\n\n<li class=\"\">Make the uploaded scripts executable (Use the <strong><kbd>chmod +x<\/kbd><\/strong> option).<\/li>\n\n\n\n<li class=\"\">In the JetStream DR UI (<em>Create Runbook Group <\/em>workflow) indicate the locations of the scripts and any parameters necessary to run the scripts.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"762\" height=\"586\" src=\"https:\/\/jetstreamsoft.com\/portal\/wp-content\/uploads\/2023\/06\/runbook-script.png\" alt=\"\" class=\"wp-image-2572\" srcset=\"https:\/\/jetstreamsoft.com\/portal\/wp-content\/uploads\/2023\/06\/runbook-script.png 762w, https:\/\/jetstreamsoft.com\/portal\/wp-content\/uploads\/2023\/06\/runbook-script-300x231.png 300w, https:\/\/jetstreamsoft.com\/portal\/wp-content\/uploads\/2023\/06\/runbook-script-50x38.png 50w\" sizes=\"(max-width: 762px) 100vw, 762px\" \/><\/figure>\n\n\n\n<p class=\"is-style-alert wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon\">Script execution details can be reviewed from the MSA tasks logs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Script Configuration Example<\/h3>\n\n\n\n<h5 class=\"wp-block-heading\">Copy scripts to MSA scripts folder<\/h5>\n\n\n\n<p class=\"\"><code>[root@fs074-msa3 scripts]# ls -lrh<br>total 12K<br>-rw-r--r--. 1 root root 5.9K Mar 24 15:36 pre-script.py<br>-rw-r--r--. 1 root root 4.0K Mar 24 10:16 post-script.py<\/code><\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Make scripts executable<\/h5>\n\n\n\n<p class=\"\"><code>[root@fs074-msa3 scripts]# chmod +x \/var\/lib\/vme2\/scripts\/*<\/code><\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Verify executable status of scripts<\/h5>\n\n\n\n<p class=\"\"><code>[root@fs074-msa3 scripts]# ls -lrh<br>total 12K<br>-rwxr-xr-x. 1 root root 5.9K Mar 24 15:36 pre-script.py<br>-rwxr-xr-x. 1 root root 4.0K Mar 24 10:16 post-script.py<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Test Script<\/h3>\n\n\n\n<p class=\"\">A sample test script is available from JetStream Software for evaluation purposes and can be used per the following guidelines:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"\">Collect the sample script from the JetStream Software support team.<br>&nbsp;<\/li>\n\n\n\n<li class=\"\">The script is written in Python and requires Python <em><strong>pyVmomi<\/strong> <\/em>SDK module version (8.0.0.1.2) to be installed on the MSA or manually updated.\n<ul class=\"wp-block-list\">\n<li class=\"\">The script will not run correctly if the pyVmomi version is lower than (8.0.0.1.2).\n<ul class=\"wp-block-list\">\n<li class=\"\">To check the version of pyVmomi currently installed, run the command: <br><strong><kbd>pip3 show pyvmom<\/kbd><\/strong><code><strong>i<\/strong><\/code><\/li>\n\n\n\n<li class=\"\">If the version is incorrect, upgrade the module using the command: <br><strong><kbd>pip3 install -U pyvmomi<\/kbd><\/strong><br>\u00a0<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li class=\"\">After placing the script in the correct folder and making it executable, run the <strong>help <\/strong>command to view its required parameters:<br><strong><kbd>python3 post-script.py -help<\/kbd><\/strong><br>\u00a0<\/li>\n\n\n\n<li class=\"\">The script can be also be tested manually by executing the following syntax:<br><strong><kbd>Python3 post-script.py -vi VCHOSTNAME -vu VCUSER -vp VCPASSWD -cl CLUSTERNAME -l VMSLIST -vmu VMUSER -vmp VMPASSWD -vmpc VMPROCESS<\/kbd><\/strong><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Changes can be made to Guest VMs after recovery by executing pre-scripts and post-scripts as part of runbook execution. Run-book scripts are custom scripts written in Python (.py) that can be created and applied by the user based upon their own specific requirements. Steps to Execute Runbook Scripts Script Configuration Example Copy scripts to MSA [&hellip;]<\/p>\n","protected":false},"author":1,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"ht-kb-category":[245],"ht-kb-tag":[214],"class_list":["post-2571","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-how-to","ht_kb_tag-vmprotection"],"_links":{"self":[{"href":"https:\/\/jetstreamsoft.com\/portal\/wp-json\/wp\/v2\/ht-kb\/2571","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jetstreamsoft.com\/portal\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/jetstreamsoft.com\/portal\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/jetstreamsoft.com\/portal\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jetstreamsoft.com\/portal\/wp-json\/wp\/v2\/comments?post=2571"}],"version-history":[{"count":1,"href":"https:\/\/jetstreamsoft.com\/portal\/wp-json\/wp\/v2\/ht-kb\/2571\/revisions"}],"predecessor-version":[{"id":5620,"href":"https:\/\/jetstreamsoft.com\/portal\/wp-json\/wp\/v2\/ht-kb\/2571\/revisions\/5620"}],"wp:attachment":[{"href":"https:\/\/jetstreamsoft.com\/portal\/wp-json\/wp\/v2\/media?parent=2571"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/jetstreamsoft.com\/portal\/wp-json\/wp\/v2\/ht-kb-category?post=2571"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/jetstreamsoft.com\/portal\/wp-json\/wp\/v2\/ht-kb-tag?post=2571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}