Skip to content

Commit

Permalink
added catalog create role
Browse files Browse the repository at this point in the history
  • Loading branch information
adworjan committed May 2, 2024
1 parent 487a2f4 commit 0897482
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 11 deletions.
1 change: 1 addition & 0 deletions .ansible-sign/sha256sum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ d8d966ccdf1e73840974c82ced8da6002e81ecd1c7a94250401f9d2441778dd0 ServiceNowtick
334fb3b18b3bbd7c3893d712ead7506eddc48d3a3cec54fd40efb04d8535eb1e collections/requirements.yml
51ad299cb34ed6d3aebddc79674e7fb1d3a52a2f5060d53f341199d7f0a77cbd devfile.yaml
f8f63300d2a511a2497b34ee831c4bec65d79f7780d2cc52989c977e4018698b roles/servicenow_catalog/tasks/main.yml
02b64b80b3ba78de459f1ec22197b2f5a01f08b13ec374674052ff89c8f68f47 roles/servicenow_catalog_create/tasks/main.yml
dca8e6b77670bfa74e7302585937d64975a04bd09381c126d683d73fa7fd94c5 roles/servicenow_change_request/defaults/main.yml
1c8c3ab1069136518c7fc6ad8754ee63eb73935ad2a9aacfe0f0121e30bf0ed6 roles/servicenow_change_request/tasks/main.yml
a3dc6c14a17f1d5b86f466016d23278f80b334c28b84a73d1671255af0cd57ac roles/servicenow_change_request/tasks/servicenow_canceled.yml
Expand Down
22 changes: 11 additions & 11 deletions .ansible-sign/sha256sum.txt.sig
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
-----BEGIN PGP SIGNATURE-----

iQGzBAABCAAdFiEE/bJvyFHKKJdaZDOLTiIiIXrUDNEFAmYytUYACgkQTiIiIXrU
DNH31Av+PLqHa8ThrN7l0yur/YKKvYSV8+ij78d8aVR127s1zKL1V/ehVK+7emnu
TKv06e/iaFb4R+iDC2WqFScCxJ/Nlk1YuU7ZlCQlDjv4IBQuLjgr9bYO6BfK/QMz
e9qnQy6qn81LTChebFP+l7wLRJjnfNpnx82Xi3S54gnB699wQED5H+pqnaWcJi++
fvrPtwzhjVsqXzDKRE2F77sapLVGA1ZH2bnwnEUxyHKV1k1ql9+2qHU+R0Zi6hwt
FN9nUIiNURWraGKwJuH6+vvCPfhD6XSWeWk5/3/cs+x7NLdsdE7uBljn7rDgbgfr
+F6ejY/83skkEc6w16uEuTWzKHjW76aY61WBdla9waEozMzS2OAKmNyGhCYjHWpk
CdmfsEypFev4YvewQmiJMeO9rsPwbqjziF/nv1xlin4JedxXX+pdU7qZpeKAQgGV
P2ZJgTI1Ek8YWsrIl4D1EOqw5r4npDo3mYy4ycgh9YgZSNA+7I9eDilIBO0FLNxU
C22NmagI
=/bjr
iQGyBAABCAAdFiEE/bJvyFHKKJdaZDOLTiIiIXrUDNEFAmYzkGoACgkQTiIiIXrU
DNHchAv1GhEfCyt7yh8eenj/RqjdP8VGD0MnWSqnxKRq6ZXwkiBUycdnblT4Sk5U
O9R+PN7BgmZOgr3lfPNSnKE3rohbeFo0sNJLTmC3hv8BR3BAitzyezD0yh0JQI5A
acngOlyUYsxI6f0BMOdUlCL0Man+3xH7eBujdQsYp6pNou2ssTCkd6PeMJVAhSck
uLuzG7nyarZd4+UAtwxAtwbxG6+XS6OICTXsN5xardylmSLOhc25vArHzljwQdAa
jbYdcDLfCzmujxiKI0De6w19fRKAjPp+6dXt+r8qbYmA4pZ2HvYVzY4X1yfpobOi
JiW52xkggOl9YTW7apqZ7oymVOuZiYpbtAMWMMKl6aTpX4WrEqRtO7XXRnYIg2HH
R64gnqO8zPDXFhW3mJnuxeG40KALr+PHPSQxD7EIyo1rtMsDsc94bFUo+KCG4wVS
i1DEpxZ0OK80U+UA05KeOZa1U8xqm0oep0Ztiv7VRohjBR9Bmmkon0Iv3OKQQkRF
5QctoAk=
=w+v7
-----END PGP SIGNATURE-----
81 changes: 81 additions & 0 deletions roles/servicenow_catalog_create/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
- name: Check if category already exists
servicenow.itsm.api_info:
resource: sc_category
sysparm_query: titleSTARTSWITHAnsible Jobs
register: categoryresult

- name: Create Catalog Category
servicenow.itsm.api:
resource: sc_category
action: post
data:
title: "Ansible Jobs"
sc_catalog: "Service Catalog"
description: "Jobs launced from AAP"
active: true
when: categoryresult.record | length == 0

- name: Check if Catalog Item already exists
servicenow.itsm.api_info:
resource: sc_cat_item
sysparm_query: nameSTARTSWITHProvision VM
register: catalogitemresult

- name: Create Catalog Item
servicenow.itsm.api:
resource: sc_cat_item
action: post
data:
name: "Provision VM"
sc_catalogs: "Service Catalog"
category: "Ansible Jobs"
active: true
short_description: "Deploy a new virtual machine"
when: catalogitemresult.record | length == 0

- name: Create Single Line Variable
servicenow.itsm.api:
resource: item_option_new
action: post
data:
type: "Single Line Text"
cat_item: "Provision VM"
question_text: "What is your VM name?"
name: "vm_name"
active: true
mandatory: true
order: 100
when: catalogitemresult.record | length == 0

- name: Create Multi Select Variable
servicenow.itsm.api:
resource: item_option_new
action: post
data:
type: "Select Box"
cat_item: "Provision VM"
question_text: "Pick your OS"
name: "operating_system"
order: 200
active: true
mandatory: true
when: catalogitemresult.record | length == 0

- name: Add Options to Multi Select Variable
servicenow.itsm.api:
resource: question_choice
action: post
data:
type: "Select Box"
cat_item: "Provision VM"
question: "Pick your OS"
text: "{{ item.text }}"
value: "{{ item.value }}"
order: "{{ item.order }}"
loop:
- { text: 'RHEL7', value: 'RHEL7', order: '100' }
- { text: 'RHEL8', value: 'RHEL8', order: '200' }
- { text: 'RHEL9', value: 'RHEL9', order: '300' }
- { text: 'Win2016', value: 'Win2016', order: '400' }
when: catalogitemresult.record | length == 0

0 comments on commit 0897482

Please sign in to comment.