---
- name: open a change request
  hosts: student1-ansible-1
  vars:
    change_request:
      severity: 2
      priority: 2
      description: Automated  Provisioning
      justification: Ansible Triggered
      implementation_plan: Updated by Red Hat AAP
      risk_impact_analysis: Changes are made automatically based on approved changes
      test_plan: Run synthetic validation tests post-deployment
      short_description: Automated  Provisioning
  tasks:
    - name: Create a change request
      servicenow.itsm.change_request:
        instance:
          host: "https://{{ snow_instance }}.service-now.com"
          username: "{{ snow_username }}"
          password: "{{ snow_password }}"
        type: standard
        state: new
        requested_by: admin
        short_description: "{{ change_request.short_description }}"
        description: "{{ change_request.description }}"
        priority: moderate
        risk: low
        impact: low
      register: new_incident

    - debug:
        var: new_incident.record.number
