Skip to content

Commit

Permalink
Merge pull request #565 from cloin/devel
Browse files Browse the repository at this point in the history
Pull track into git and fix directions
  • Loading branch information
cloin authored Feb 20, 2024
2 parents b73bb6d + 1cb97ec commit 1a9d4b7
Show file tree
Hide file tree
Showing 19 changed files with 193 additions and 138 deletions.
10 changes: 8 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# https://hub.docker.com/_/fedora
FROM fedora:37
FROM fedora:38

# update and install OS packages
RUN dnf -y update && dnf -y install \
RUN dnf -y update && dnf -y groupinstall "Development Tools" && \
dnf -y install \
python3-pip \
python3-devel \
libffi-devel \
oniguruma-devel \
gcc \
wget \
vim \
unzip \
Expand All @@ -17,6 +21,8 @@ RUN pip3 install -r requirements.txt

# configure user and sudo
RUN useradd vscode
# permission to vscode user
# RUN mkdir -p /workspaces && chown -R vscode:vscode /workspaces
RUN sudo sed -e 's/^%wheel/#%wheel/g' -e 's/^# %wheel/%wheel/g' \
-i /etc/sudoers && \
usermod -aG wheel vscode
Expand Down
5 changes: 1 addition & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"build": {
"dockerfile": "Dockerfile",
"context" : ".."
// Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04
// Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon.
// "args": { "VARIANT": "ubuntu-22.04" }
},

// Set *default* container specific settings.json values on container create.
Expand All @@ -24,5 +21,5 @@
// "postCreateCommand": "uname -a",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
// "remoteUser": "vscode"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ teaser: Automate incident creation
notes:
- type: text
contents: |-
<p align="center">
<img width="400" src="../assets/snow-aap.png">
</p>
The ServiceNow integration for Ansible Automation Platform is made possible
through a certified content collection called `servicenow.itsm`. This collection
is made available on Automation Hub on `console.redhat.com`. The environment that
is made available on Automation Hub on [console.redhat.com](https://console.redhat.com). The environment that
is being created for you includes this collection in an execution environment
that allows Ansible Automation Platform to execute tasks against a ServiceNow
instance.
Expand All @@ -37,15 +34,15 @@ tabs:
url: https://ansible.service-now.com
new_window: true
difficulty: basic
timelimit: 400
timelimit: 420
---
👋 Introduction
====
In ITIL, an incident refers to an unplanned outage or reduction in quality of an IT service or application. ServiceNow implements technology mapped to ITIL terminology and is accepted as an industry standard for incident management.

The servicenow.itsm certified collection allows organizations to leverage incident management within Ansible Automation Platform workflows.

A playbook as been created in the `VS Code` tab called `incident-create.yml`.
A playbook has been created in the `VS Code` tab called `incident-create.yml`.
- Inspect this playbook and review the in-line comments to understand how the collection is being leveraged.

▶️ Create incident
Expand All @@ -59,7 +56,14 @@ A playbook as been created in the `VS Code` tab called `incident-create.yml`.
====

If the previous step completed successfully, you should see a new incident has been created. To verify that this is the case:
- Use the ServiceNow credentials from `readme.md` to access ServiceNow from the `ServiceNow` tab.
- Use the ServiceNow credentials listed below or from `readme.md` to access ServiceNow from the `ServiceNow` tab.


| key | value |
| -------- | -------- |
| username | [[ Instruqt-Var key="SANDBOX" hostname="controller" ]] |
| password | [[ Instruqt-Var key="SANDBOX" hostname="controller" ]]


- In ServiceNow, click the star icon to access pre-configured favorites and select `Self-service - Incidents`:
![servicenow screenshot](../assets/snow-star.png)
Expand All @@ -71,4 +75,4 @@ Move onto the next section by selecting the green "Next" button below.

🐛 Encountered an issue?
====
If you have encountered an issue or have noticed something not quite right, please [open an issue](https://github.com/ansible/instruqt/issues/new?labels=getting-started-servicenow-automation&title=New+servicenow+issue:+incident-creation&assignees=cloin).
If you have encountered an issue or have noticed something not quite right, please [open an issue](https://github.com/ansible/instruqt/issues/new?labels=getting-started-servicenow-automation&title=New+servicenow+issue:+incident-creation+(Sandbox+id:+[[ Instruqt-Var key="SANDBOX" hostname="controller" ]])&assignees=cloin&body=).
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ tee /home/rhel/challenge-1/template-create.yml << EOF
organization: "Default"
inventory: "Demo Inventory"
project: "ServiceNow"
playbook: "incident-create.yml"
playbook: "student_project/incident-create.yml"
execution_environment: "ServiceNow EE"
use_fact_cache: false
credentials:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tabs:
url: https://ansible.service-now.com
new_window: true
difficulty: basic
timelimit: 400
timelimit: 420
---
👋 Introduction
====
Expand Down Expand Up @@ -53,4 +53,4 @@ Move onto the next section by selecting the green "Next" button below.

🐛 Encountered an issue?
====
If you have encountered an issue or have noticed something not quite right, please [open an issue](https://github.com/ansible/instruqt/issues/new?labels=getting-started-servicenow-automation&title=New+servicenow+issue:+attach-problem&assignees=cloin).
If you have encountered an issue or have noticed something not quite right, please [open an issue](https://github.com/ansible/instruqt/issues/new?labels=getting-started-servicenow-automation&title=New+servicenow+issue:+attach-problem+(Sandbox+id:+[[ Instruqt-Var key="SANDBOX" hostname="controller" ]])&assignees=cloin).
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ tee /home/rhel/servicenow_project/problem-attach.yml << EOF
- name: Assign a problem to a user for assessment
servicenow.itsm.problem:
number: "{{ problem.record.number }}"
state: assess
state: 1
assigned_to: "{{ lookup('env', 'SN_USERNAME') }}"
- name: Update incident status now that problem has been created
Expand Down Expand Up @@ -78,7 +78,7 @@ tee /home/rhel/challenge-2/template-create.yml << EOF
organization: "Default"
inventory: "Demo Inventory"
project: "ServiceNow"
playbook: "problem-attach.yml"
playbook: "student_project/problem-attach.yml"
execution_environment: "ServiceNow EE"
credentials:
- "servicenow credential"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tabs:
url: https://ansible.service-now.com
new_window: true
difficulty: basic
timelimit: 400
timelimit: 420
---
👋 Introduction
====
Expand All @@ -36,7 +36,7 @@ A new playbook has been created in your `VS Code` tab.

▶️ Create a change request
====
- Navigate to `Resources > Job Templates` in automation controller and launch the job template `3 - Attach change request (change-attach.yml)`
- Navigate to `Resources > Templates` in automation controller and launch the job template `3 - Attach change request (change-attach.yml)`
- Watch for job completion in automation controller

🔍 Inspect results
Expand All @@ -47,4 +47,4 @@ Move onto the next section by selecting the green "Next" button below.

🐛 Encountered an issue?
====
If you have encountered an issue or have noticed something not quite right, please [open an issue](https://github.com/ansible/instruqt/issues/new?labels=getting-started-servicenow-automation&title=New+servicenow+issue:+fix-and-close&assignees=cloin).
If you have encountered an issue or have noticed something not quite right, please [open an issue](https://github.com/ansible/instruqt/issues/new?labels=getting-started-servicenow-automation&title=New+servicenow+issue:+fix-and-close+(Sandbox+id:+[[ Instruqt-Var key="SANDBOX" hostname="controller" ]])&assignees=cloin).
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ tee /home/rhel/servicenow_project/change-attach.yml << EOF
- name: Assign problem for assessment
servicenow.itsm.problem:
number: "{{ item.number }}"
state: assess
state: 3
assigned_to: "{{ demo_username }}"
loop: "{{ problem_list }}"
Expand Down Expand Up @@ -78,7 +78,7 @@ tee /home/rhel/challenge-3/template-create.yml << EOF
organization: "Default"
inventory: "Demo Inventory"
project: "ServiceNow"
playbook: "change-attach.yml"
playbook: "student_project/change-attach.yml"
execution_environment: "ServiceNow EE"
credentials:
- "servicenow credential"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tabs:
url: https://ansible.service-now.com
new_window: true
difficulty: basic
timelimit: 400
timelimit: 420
---
👋 Introduction
====
Expand Down Expand Up @@ -53,4 +53,4 @@ Move onto the next section by selecting the green "Next" button below.

🐛 Encountered an issue?
====
If you have encountered an issue or have noticed something not quite right, please [open an issue](https://github.com/ansible/instruqt/issues/new?labels=getting-started-servicenow-automation&title=New+servicenow+issue:+configuration-items&assignees=cloin).
If you have encountered an issue or have noticed something not quite right, please [open an issue](https://github.com/ansible/instruqt/issues/new?labels=getting-started-servicenow-automation&title=New+servicenow+issue:+configuration-items+(Sandbox+id:+[[ Instruqt-Var key="SANDBOX" hostname="controller" ]])&assignees=cloin).
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ tee /home/rhel/servicenow_project/create-update-config-items.yml << EOF
connection: local
collections:
- servicenow.itsm
vars:
demo_username: "{{ lookup('env', 'SN_USERNAME') }}"
tasks:
- name: Create/update configuration item
servicenow.itsm.configuration_item:
name: "{{ item.hostname }}"
name: "{{ item.hostname }}-{{ demo_username }}"
assigned_to: "{{ demo_username }}"
ip_address: "{{ item.default_ip }}"
mac_address: "{{ item.default_mac }}"
environment: test
Expand All @@ -45,6 +48,12 @@ tee /home/rhel/servicenow_project/create-update-config-items.yml << EOF
loop: "{{ node_info }}"
register: configuration_item
- name: debug
debug:
msg: "{{ configuration_item }}"
EOF

# chown above file
Expand All @@ -68,7 +77,7 @@ tee /home/rhel/challenge-4/template-create.yml << EOF
organization: "Default"
inventory: "rhel inventory"
project: "ServiceNow"
playbook: "collect-node-info.yml"
playbook: "student_project/collect-node-info.yml"
execution_environment: "ServiceNow EE"
credentials:
- "rhel credential"
Expand All @@ -87,7 +96,7 @@ tee /home/rhel/challenge-4/template-create.yml << EOF
organization: "Default"
inventory: "Demo Inventory"
project: "ServiceNow"
playbook: "create-update-config-items.yml"
playbook: "student_project/create-update-config-items.yml"
execution_environment: "ServiceNow EE"
credentials:
- "servicenow credential"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tabs:
url: https://ansible.service-now.com
new_window: true
difficulty: basic
timelimit: 400
timelimit: 420
---
👋 Introduction
====
Expand All @@ -47,4 +47,4 @@ Now that everything has been cleaned up, move onto the next challenge! Click the

🐛 Encountered an issue?
====
If you have encountered an issue or have noticed something not quite right, please [open an issue](https://github.com/ansible/instruqt/issues/new?labels=getting-started-servicenow-automation&title=New+servicenow+issue:+query-and-update-records&assignees=cloin).
If you have encountered an issue or have noticed something not quite right, please [open an issue](https://github.com/ansible/instruqt/issues/new?labels=getting-started-servicenow-automation&title=New+servicenow+issue:+query-and-update-records+(Sandbox+id:+[[ Instruqt-Var key="SANDBOX" hostname="controller" ]])&assignees=cloin).
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ tee /home/rhel/challenge-5/template-create.yml << EOF
organization: "Default"
inventory: "Demo Inventory"
project: "ServiceNow"
playbook: "close-records-by-user.yml"
playbook: "student_project/close-records-by-user.yml"
execution_environment: "ServiceNow EE"
credentials:
- "servicenow credential"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ tabs:
hostname: controller
url: https://ansible.service-now.com
new_window: true
difficulty: basic
timelimit: 400
difficulty: ""
timelimit: 420
---
👋 Introduction
====
Expand All @@ -37,7 +37,7 @@ A new inventory has been added to Automation Controller, but it hasn't queried a

👀 Review inventories
====
- First, open the Automation Controller tab and navigator the right hand navigation pane to `Hosts`. Notice that this list is empty. This is because the integration between Ansible Automation Platform and ServiceNow is an API to API integration where the endpoints we're targeting are not individual hosts, but an API.
- First, open the Automation Controller tab and navigate the right hand navigation pane to `Hosts`. Notice that this list is empty. This is because the integration between Ansible Automation Platform and ServiceNow is an API to API integration where the endpoints we're targeting are not individual hosts, but an API.

▶️ Sync ServiceNow inventory
====
Expand Down Expand Up @@ -70,4 +70,4 @@ group_by:

🐛 Encountered an issue?
====
If you have encountered an issue or have noticed something not quite right, please [open an issue](https://github.com/ansible/instruqt/issues/new?labels=getting-started-servicenow-automation&title=New+servicenow+issue:+servicenow-inventory&assignees=cloin).
If you have encountered an issue or have noticed something not quite right, please [open an issue](https://github.com/ansible/instruqt/issues/new?labels=getting-started-servicenow-automation&title=New+servicenow+issue:+servicenow-inventory+(Sandbox+id:+[[ Instruqt-Var key="SANDBOX" hostname="controller" ]])&assignees=cloin).
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tee /home/rhel/challenge-6/create-inventory-project.yml << EOF
organization: Default
state: present
scm_type: git
scm_url: https://github.com/cloin/servicenow_inventory
scm_url: https://github.com/cloin/instruqt-snow
scm_update_on_launch: true
controller_host: "https://localhost"
controller_username: admin
Expand Down
Binary file not shown.
31 changes: 17 additions & 14 deletions tracks/getting-started-servicenow-automation/config.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
version: "3"
virtualmachines:
- name: node2
image: red-hat-mbu/ansible
shell: /bin/su - rhel -s /bin/bash
machine_type: n1-standard-1
- name: node1
image: red-hat-mbu/ansible
shell: /bin/su - rhel -s /bin/bash
machine_type: n1-standard-1
- name: controller
image: red-hat-mbu/automation-controller
shell: /bin/su - rhel -s /bin/bash
environment:
TERM: xterm
machine_type: n1-standard-4
- name: node2
image: red-hat-mbu/ansible
shell: /bin/su - rhel -s /bin/bash
machine_type: n1-standard-1
- name: node1
image: red-hat-mbu/ansible
shell: /bin/su - rhel -s /bin/bash
machine_type: n1-standard-1
- name: controller
image: red-hat-mbu/automation-controller
shell: /bin/su - rhel -s /bin/bash
environment:
TERM: xterm
machine_type: n1-standard-4
allow_external_ingress:
- http
- https
22 changes: 12 additions & 10 deletions tracks/getting-started-servicenow-automation/track.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
slug: getting-started-servicenow-automation
id: faoq9b1onz2h
type: track
title: Getting started with ServiceNow automation
teaser: Explore base functionality provided by the ServiceNow collection for Ansible
Automation Platform
title: Get started with ServiceNow automation
description: Ansible Automation Platform brings certified integrations to some of
the most popular IT services. Learn how to leverage a supported integration with
ServiceNow in order to implement closed loop automation through incident and CMDB
management to ensure your organizations source of truth remains trustworthy.
icon: ""
level: beginner
tags:
- itsm
- ' servicenow'
- ' cmdb'
- cmdb
- servicenow
owner: redhat
developers:
- colin@redhat.com
private: false
published: true
show_timer: true
checksum: "17712047228775310334"
timelimit: 3300
lab_config:
overlay: false
width: 33
position: right
extend_ttl: 3300
feedback_recap_enabled: true
loadingMessages: true
checksum: "13692025422635255806"
Loading

0 comments on commit 1a9d4b7

Please sign in to comment.