{"id":3482,"date":"2013-03-02T08:27:38","date_gmt":"2013-03-02T07:27:38","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=3482"},"modified":"2013-03-02T08:28:43","modified_gmt":"2013-03-02T07:28:43","slug":"apply-runbook-best-practices-quick-and-dirty","status":"publish","type":"post","link":"https:\/\/contoso.se\/blog\/?p=3482","title":{"rendered":"Apply runbook best practices (quick and dirty)"},"content":{"rendered":"<p>Last week I was working on private cloud solution that included around 50 runbooks. In the end of the development phase we needed to make sure all runbooks was following best\u00c2\u00a0practices, including naming convention and design standard. For example all links between activities that had a name including &#8220;IF&#8221; should be updated to orange color, and all runbooks named &#8220;Link&#8221; should be updated to green color. As we had a lot of runbooks I was thinking about a quick way to updated them all, instead of manually updating each link. We also wanted to update some activity names based on the configuration.<\/p>\n<p>The answer was a couple of SQL queries<\/p>\n<p>To update all non-deleted (Deleted = 0) runbooks that have black (default) color and named Link (default) to green link color<\/p>\n<blockquote><p>Update LINKS SET Color=&#8217;65280&#8242; WHERE Color = &#8216;0&#8217; AND UniqueID IN (select uniqueID from OBJECTS WHERE ObjectType = &#8216;7A65BD17-9532-4D07-A6DA-E0F89FA0203E&#8217; AND Name = &#8216;Link&#8217; AND Deleted = &#8216;0&#8217;)<\/p><\/blockquote>\n<p>As you can see we set the color to 65280,<\/p>\n<ul>\n<li><span style=\"line-height: 13px;\">Green is 65280<\/span><\/li>\n<li>Black is 0<\/li>\n<li>Red is 255<\/li>\n<li>Orange is 4227327<\/li>\n<\/ul>\n<p>To updated all non-deleted links that have name that contains &#8220;warning&#8221; to red link color, run<\/p>\n<blockquote><p>Update LINKS SET Color=&#8217;255&#8242; WHERE Color = &#8216;0&#8217; AND UniqueID IN (select uniqueID from OBJECTS WHERE ObjectType = &#8216;7A65BD17-9532-4D07-A6DA-E0F89FA0203E&#8217; AND Name like &#8216;%Warning%&#8217; AND Deleted = &#8216;0&#8217;)<\/p><\/blockquote>\n<p>If you want to update link width for all links named &#8220;Link&#8221; you can run the following query<\/p>\n<blockquote><p>Update LINKS SET Width=&#8217;3&#8242; WHERE UniqueID IN (select uniqueID from OBJECTS WHERE ObjectType = &#8216;7A65BD17-9532-4D07-A6DA-E0F89FA0203E&#8217; AND Name = &#8216;Link&#8217; AND Deleted = &#8216;0&#8217;)<\/p><\/blockquote>\n<p>If you want to update all Invoke Runbook activities with a name starting with &#8220;Invoke&#8221;, and set the name to the runbook it invoke you can run the following query<\/p>\n<blockquote><p>UPDATE OBJECTS<br \/>\nSET objects.Name = TRIGGER_POLICY.PolicyPath<br \/>\nFROM OBJECTS, TRIGGER_POLICY<br \/>\nWHERE objects.UniqueID = TRIGGER_POLICY.UniqueID<br \/>\nAND objects.name LIKE &#8216;INVOKE%&#8217; AND Deleted = &#8216;0&#8217;<br \/>\nGO<\/p><\/blockquote>\n<p>You\u00c2\u00a0don&#8217;t\u00c2\u00a0need to checkout your runbook to \u00c2\u00a0apply the modification, just refresh the console after the update.<\/p>\n<p>&nbsp;<\/p>\n<p>Please note that is\u00c2\u00a0<span style=\"color: #ff0000;\">unsupported<\/span> as we modify settings in the database direct.\u00c2\u00a0This is provided \u00e2\u20ac\u0153AS-IS\u00e2\u20ac\u009d with no warranties at all. This is not a solution for your production environment, just a idea and an example.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week I was working on private cloud solution that included around 50 runbooks. In the end of the development phase we needed to make sure all runbooks was following best\u00c2\u00a0practices, including naming convention and design standard. For example all links between activities that had a name including &#8220;IF&#8221; should be updated to orange color, &hellip; <a href=\"https:\/\/contoso.se\/blog\/?p=3482\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[60],"tags":[],"_links":{"self":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3482"}],"collection":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3482"}],"version-history":[{"count":8,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3482\/revisions"}],"predecessor-version":[{"id":3490,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3482\/revisions\/3490"}],"wp:attachment":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3482"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}