Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
//
// bw - 20120416 - adapted from http://wiki.service-now.com/index.php?title=Post-Cloning_Checklist

//
// canonical instance names... change if any instance name changes
var dev = "yaledevelopment";
var tst = "yaletest";
var trn = "yaletraining";
var pre = "yalepreproduction";
var prd = "yale";

//
//get this instance's name
var thisInstance = gs.getProperty("instance_name");
 
//
// all non-prod is broken out in case the need arises to break formation
// with the defaultConfig().
switch (thisInstance) {
	case prd: 
                // shouldn't be cloning prod post-go-live!
		gs.print("**** You're running this script in production, are you asking for trouble?");
		break;
	case dev: 
                var thisShortName = "dev";
                var thisIST = "ist3";
                var thisDWH = "dwh7";
                var thisAdmins = ["ww26-admin","ekt6-admin","bm364-admin","gilbert-admin","drm43-admin"];
		defaultConfig(thisInstance,thisShortName,thisIST,thisDWH,thisAdmins);
		break;
	case tst: 
                var thisShortName = "tst";
                var thisIST = "ist2";
                var thisDWH = "dwh4";
                var thisAdmins = ["ww26-admin","vb248-admin"];
		defaultConfig(thisInstance,thisShortName,thisIST,thisDWH,thisAdmins);
		break;
	case trn: 
                var thisShortName = "trn";
                var thisIST = "ist1";
                var thisDWH = "dwh1";
                var thisAdmins = ["ww26-admin","mo4-admin","kb32-admin"];
		defaultConfig(thisInstance,thisShortName,thisIST,thisDWH,thisAdmins);
		break;
	case pre: 
                var thisShortName = "pre"; 
                var thisIST = "ist1"; 
                var thisDWH = "dwh1";   
                var thisAdmins = ["ww26-admin"];           
		defaultConfig(thisInstance,thisShortName,thisIST,thisDWH,thisAdmins);
		break;
	default: 
		gs.print("**** I don't understand what this instance is for: " + thisInstance);
}

// 
// default way to configure a non-prod instance
function defaultConfig(instance, shortName, IST, DWH) {
	//set the base color (did we decide yet??)
	// gs.setProperty("css.base.color","mediumseagreen");
 
	//set header name (did we decide yet??)
	// gs.setProperty("glide.product.description","DEV Instance");

        setSAMLProperties(instance);
 // set SAML properties    setSMTPProperties(shortName);
    gs.setProperty("glide.authenticate.sso.saml2.issuer","https://" + instance + ".service-now.com" setPOP3Properties(shortName);

        gs.setProperty("glide.authenticate.sso.saml2.service_url","https://" + instance + ".service-now.com/navpage.do");
         // align setinstance-specific SMTPdata propertiessources
        gs.setPropertysetDataSourceURL("glide.email.userIST-User","servicenow-jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/" + shortNameIST + "@yale.edu,cn=oracleContext,dc=world");     
   gs.setProperty("glide.email.server","smtp.gmail.com");
        gs.setProperty("glide.smtp.port",587     setDataSourceURL("DW - Manager","jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/" + DWH + ",cn=oracleContext,dc=world");     
   gs.setProperty("glide.smtp.tls",true);         gs.setProperty("glide.smtp.auth",true);
        gs.setProperty("glide.smtp.active",true);  // for now, maybe we'll only do this for test later on
        gs.setProperty("glide.email.test.user","its50test@mailman.yale.edu");setDataSourceURL("DWH-DIVDEPTORG","jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/" + DWH + ",cn=oracleContext,dc=world");     

        // let the admin know we're all done
	gs.print("RememberApplied to set glide.email.test.user_passwordInstance-Specific Configurations"); 
  
} // end defaultConfig()


function setSAMLProperties(instance) {
        //
        // set POP3SAML properties so SSO logins are redirected to the right instance
        gs.setProperty("glide.authenticate.sso.pop3saml2.serverissuer","pop.gmail.com");
        gs.setProperty("glide.pop3.secure",truehttps://" + instance + ".service-now.com");
        gs.setProperty("glide.authenticate.sso.pop3saml2.userservice_url","servicenow-https://" + shortNameinstance + "@yale.edu");
	gs.print("Remember to set glide.pop3.password.service-now.com/navpage.do");
  
} // end setSAMLProperties()


// set notification From: and Reply-To: addresses for all active Email Notificationsfunction setSMTPProperties(shortName) {
        //
        // bwset -SMTP doesn'tproperties reallyfor worka in all cases, no longer needed w/ eliapps (gmail)given instance... assume password the same across instances.
         // gr = new GlideRecord("sysevent_email_actiongs.setProperty("glide.email.user","servicenow-" + shortName + "@yale.edu");
        // gr.addQuery("activegs.setProperty("glide.email.server","=",truesmtp.gmail.com");
        // gr.query(gs.setProperty("glide.smtp.port",587);
        // while(gr.next()) {gs.setProperty("glide.smtp.tls",true);
         //gs.setProperty("glide.smtp.auth",true);
   gr.from = "servicenow-" + shortName + "@yale.edu" gs.setProperty("glide.smtp.active",true);  // for now, maybe we'll only do this for //test later on
  gr.reply_to = "servicenow-" + shortName + "@yale gs.setProperty("glide.email.test.user","its50test@mailman.yale.edu");
  //
} //    //end setSMTPProperties()


function gr.updatesetPOP3Properties(shortName); {
        //
}          // alignset ISTPOP3 data source(s)
        gr = new GlideRecord("sys_data_source");properties for a given instance... assume password the same across instances.
           gr.addQuery("name","=","IST-Usergs.setProperty("glide.pop3.server","pop.gmail.com");
        grgs.query(setProperty("glide.pop3.secure",true);
         while(gr.next()) {
            gr.connection_url = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/gs.setProperty("glide.pop3.user","servicenow-" + ISTshortName + ",cn=oracleContext,dc=world"@yale.edu");
  //
} // end setPOP3Properties()


function   gr.update();
setDataSourceURL(name, url) {
       } //
        // align DWH data source(s) with this name to specified url
        var gr = new GlideRecord("sys_data_source");
        var qc = gr.addQuery("name","=","DW - Manager");
        qc.addOrCondition("name","=","DWH-DIVDEPTORG");
        gr.query(); 
        while(gr.next()) {
            gr.connection_url = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/" + DWH + ",cn=oracleContext,dc=world"url;
            gr.update();
        }
  //
  }   // let the admin know we're all done
	gs.print("Applied Instance-Specific Configurations"); 
}end setDataSourceURL()


Manual Steps

  • add MID server accounts, re-register MID servers (to script)
  • delete non-relevant (i.e. production) MID servers (to script)
  • ensure SMTP & POP passwords are correct (these should survive a clone anyway)
  • reset any user passwords for *-admin accounts (on demand... this encourages semi-regular password resets).