raising standard change using ansible

Akki6
Kilo Explorer

Hi ,

I have created a playbook that raises a change. But I already have a standardized change template. How can I raise a standard change (from standard catalog) ? 

Or Is it possible to schedule a change (a standard change) so it gets raised every month just like a cron job? can this be done in the snow portal? What are the steps?

 

Thanks!

Akki

7 REPLIES 7

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

Before creation of this change via playbook you can apply template via script as well. Can you tell me which kind of integration you are using in creation of change.

 

Thanks,
Ashutosh

Hi Ashutosh,

I am using json to input the details like description, impact, urgency etc in the change. Also raising the change using the rest API. Cant we just raise the already existing standard change? I directly want to raise a standard change as shown below in the screenshot.

##############################My Playbook#######################

- name: Raise a new change.

  uri:

    url: “https://dev80153.service-now.com/api/now/table/change

    method: POST

    user: abc

    password: xyz

    force_basic_auth: yes

    status_code: 201

 

find_real_file.png

Thank you,

Akki

Akki6
Kilo Explorer

Hello,

Any solution for this. Please let me know.

 

Thanks,

Akki

HI Akki,


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.

Thanks,
Ashutosh