Scripted Steps
Copy & paste into Background Scripts in each instance.
// // bw - 20120416 - adapted from http://wiki.service-now.com/index.php?title=Post-Cloning_Checklist // // keep pseudo-globals in object namespace to avoid name collisions var common = {}; var dev = {}; var tst = {}; var trn = {}; var pre = {}; var prd = {}; // // use to hash datasource names + urls dev.dataSources = new Array(); tst.dataSources = new Array(); trn.dataSources = new Array(); pre.dataSources = new Array(); prd.dataSources = new Array(); // // other canon (common to all but desirable here anyway) common.SMTPServer = "smtp.gmail.com"; common.SMTPPort = 587; common.SMTPTLS = true; common.SMTPAuth = true; common.POP3Server = "pop.gmail.com"; common.POP3Secure = true; // // get this instance's name common.instance = gs.getProperty("instance_name"); // // here's where you should set all instance-specific values dev.longName = "yaledevelopment"; dev.shortName = "dev"; dev.admins = ["ww26-admin","ekt6-admin","bm364-admin","gilbert-admin","drm43-admin"]; dev.SMTPUser = "servicenow-dev@yale.edu"; dev.POP3User = "servicenow-dev@yale.edu"; dev.SMTPActive = true; dev.testRcpt = "dh4234@gmail.com"; dev.dataSources["IST-User"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/ist3,cn=oracleContext,dc=world"; dev.dataSources["DW - Manager"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/dwh7,cn=oracleContext,dc=world"; dev.dataSources["DWH-DIVDEPTORG"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/dwh7,cn=oracleContext,dc=world"; tst.longName = "yaletest"; tst.shortName = "tst"; tst.admins = ["ww26-admin","vb248-admin"]; tst.SMTPUser = "servicenow-tst@yale.edu"; tst.POP3User = "servicenow-tst@yale.edu"; tst.SMTPActive = true; tst.testRcpt = "its50test@mailman.yale.edu"; tst.dataSources["IST-User"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/ist2,cn=oracleContext,dc=world"; tst.dataSources["DW - Manager"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/dwh4,cn=oracleContext,dc=world"; tst.dataSources["DWH-DIVDEPTORG"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/dwh4,cn=oracleContext,dc=world"; trn.longName = "yaletraining"; trn.shortName = "trn"; trn.admins = ["ww26-admin","mo4-admin","kb32-admin"]; trn.SMTPUser = "servicenow-trn@yale.edu"; trn.POP3User = "servicenow-trn@yale.edu"; trn.SMTPActive = false; trn.testRcpt = "its50test@mailman.yale.edu"; trn.dataSources["IST-User"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/ist1,cn=oracleContext,dc=world"; trn.dataSources["DW - Manager"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/dwh1,cn=oracleContext,dc=world"; trn.dataSources["DWH-DIVDEPTORG"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/dwh1,cn=oracleContext,dc=world"; pre.longName = "yalepreproduction"; pre.shortName = "pre"; pre.admins = ["ww26-admin"]; pre.SMTPUser = "servicenow-pre@yale.edu"; pre.POP3User = "servicenow-pre@yale.edu"; pre.SMTPActive = true; pre.testRcpt = "its50test@mailman.yale.edu"; pre.dataSources["IST-User"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/ist1,cn=oracleContext,dc=world"; pre.dataSources["DW - Manager"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/dwh1,cn=oracleContext,dc=world"; pre.dataSources["DWH-DIVDEPTORG"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/dwh1,cn=oracleContext,dc=world"; prd.longName = "yale"; prd.shortName = "prd"; prd.admins = ["ww26-admin"]; prd.SMTPUser = "servicenow@yale.edu"; prd.POP3User = "servicenow@yale.edu"; prd.SMTPActive = true; prd.testRcpt = ""; prd.dataSources["IST-User"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/ist1,cn=oracleContext,dc=world"; prd.dataSources["DW - Manager"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/dwh1,cn=oracleContext,dc=world"; prd.dataSources["DWH-DIVDEPTORG"] = "jdbc:oracle:thin:@ldap://oid.its.yale.edu:389/dwh1,cn=oracleContext,dc=world"; // // all non-prod is broken out in case the need arises to break formation // with the defaultConfig(). switch (common.instance) { case prd.longName: // 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.longName: defaultConfig(dev); break; case tst.longName: defaultConfig(tst); break; case trn.longName: defaultConfig(trn); break; case pre.longName: defaultConfig(pre); break; default: // bail if this is an unknown instance gs.print("**** I don't understand what this instance is for: " + common.instance); // } // end switch statement function defaultConfig(specific) { // // default way to configure a non-prod environment // setEnvironmentMarkers(specific.color,specific.name); setSAMLProperties(specific.longName); setDataSourceURLs(specific.dataSources); enableAdminUsers(specific.admins); setPOP3Properties(specific.POP3User, common.POP3Server, common.POP3Secure); setSMTPProperties(specific.SMTPUser , common.SMTPServer , common.SMTPPort , common.SMTPTLS , common.SMTPAuth , specific.SMTPActive, specific.testRcpt); gs.print("Applied Instance-Specific Configurations"); } // end defaultConfig() function setSAMLProperties(instance) { // // set SAML properties so SSO logins are redirected to the right instance gs.setProperty("glide.authenticate.sso.saml2.issuer","https://" + instance + ".service-now.com"); gs.setProperty("glide.authenticate.sso.saml2.service_url","https://" + instance + ".service-now.com/navpage.do"); } // end setSAMLProperties() function setSMTPProperties(user, server, port, tls, auth, active, testRcpt) { // // set SMTP properties for a given instance... assume password the same across instances. gs.setProperty("glide.email.user",user); gs.setProperty("glide.email.server",server); gs.setProperty("glide.smtp.port",port); gs.setProperty("glide.smtp.tls",tls); gs.setProperty("glide.smtp.auth",auth); gs.setProperty("glide.smtp.active",active); gs.setProperty("glide.email.test.user",testRcpt); // } // end setSMTPProperties() function setPOP3Properties(user, server, secure) { // // set POP3 properties for a given instance... assume password the same across instances. gs.setProperty("glide.pop3.server",server); gs.setProperty("glide.pop3.secure",true); gs.setProperty("glide.pop3.user",user); // } // end setPOP3Properties() function setDataSourceURLs(dataSources) { // // align data source(s) with this name to specified url for (var name in dataSources) { var gr = new GlideRecord("sys_data_source"); gr.addQuery("name","=",name); gr.query(); while(gr.next()) { gr.connection_url = dataSources[name]; gr.update(); } } // } // end setDataSourceURLs() function enableAdminUsers(admins) { // // for each user matching user_name in admins, remove lockout and activate user for (var i = 0; i < admins.length; i++) { var gr = new GlideRecord("sys_user"); gr.addQuery("user_name","=",admins[i]); gr.query(); while(gr.next()) { gr.active = true; gr.locked_out = false; gr.update(); } } } function setEnvironmentMarkers(color,name) { // set the base color gs.setProperty("css.base.color",color); // set header name gs.setProperty("glide.product.description",name); // } // end setEnvironmentMarkers()
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).