raising standard change using ansible

RajatA
Tera Contributor

Hi ,

I have created a playbook that raises a change, and every time I run the playbook it is creating a normal change only. But I already have a standardized change template (pre-approved). How can I raise a standard change (from standard catalog) ?  What will be the steps any idea about this?

Thanks!

Rajat

 
3 REPLIES 3

AJ-TechTrek
Giga Sage
Giga Sage

Hi @RajatA 

 

I have done this but using a Scripted REST API.

 

What we did is:

1) Created a Scripted Rest API.

2) In Request body we have sent few details like Template Name or sys_id, caller if any.

3) In Scripted Rest api we wrote a script where it will check for template name and apply the template to new change.

Example Script:

var rec1 = new GlideRecord("change_request");
rec1.initialize();
rec1.applyTemplate("my_std_chg_template");//Name of the template
//...possibly more code here... 

rec1.insert();

 

This works for me.

 

Please appreciate the efforts of community contributors by marking appropriate response as Mark my Answer Helpful or Accept Solution this may help other community users to follow correct solution in future.

 

Thanks

AJ

Linkedin Profile:- https://www.linkedin.com/in/ajay-kumar-66a91385/

ServiceNow Community Rising Star 2024

How can I use this in my playbook, or where should I paste this script