Skip to content

Commit 262f154

Browse files
authored
Merge pull request #414 from ansible/devel
Release September 9th, 2019
2 parents e0e6a39 + 8a09a88 commit 262f154

File tree

103 files changed

+2676
-861
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+2676
-861
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ demos/servicenow/closed_loop_incident_mgmt/snow_demo2/snow_vars.yaml
2222
provisioner/roles/ansible_security.ids_config/
2323
provisioner/roles/ansible_security.ids_install/
2424
provisioner/roles/geerlingguy.repo-epel/
25+
.pyc
26+
.swp

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ The Red Hat Ansible Automation Workshops project is intended for effectively dem
1818

1919
- [Vagrant Demo](vagrant-demo) - Self-paced networking exercises that can be run on your personal laptop
2020

21+
# Demos
22+
23+
- [Demos](demos) - These demos are intended for effectively demonstrating Ansible capabilities with prescriptive guides on the Ansible Automation Workshop infrastructure.
24+
2125
# DOCUMENTATION:
2226

2327
- [How to contribute](docs/contribute.md)

_config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ theme: jekyll-theme-dinky
22
include:
33
- "provisioner/README.md"
44
exclude:
5-
- "demos/*"
65
- "provisioner/roles"
76
- "provisioner/group_vars"
87
- "provisioner/inventory"

demos/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Demos
2+
3+
These demos are built for https://github.com/ansible/workshops. To use the demo it is recommended to run the [provisioner](../provisioner/README.md) for the correct **workshop_type**. By standardizing demos on a Ansible Workshop **workbench** it is easier to test and verify demos are always working. Feel free re-use any component of this demo but this demo is only supported in this fashion.
4+
5+
| Demo Category | Brief Description |
6+
|---|---|
7+
| [ChatOps](chatops) | The objective of this demo is showcase Ansible integrating with a chat tool like "Slack" as an interface to the managed network devices. |
8+
| [networking](networking) | Various Ansible Network Automation demos for the `workshop_type: networking`. These are meant to show off various network automation features and functions. **Note** There may be other demos that require the `workshop_type: networking` but these are meant to be exclusively "show and tell" for network automation features versus interoperability or integration with another tool. |
9+
| [Ansible + ServiceNow](servicenow) | These demos are intended for effectively demonstrating Ansible + ServiceNow capabilities with prescriptive guides on the Ansible Automation Workshop infrastructure. |
10+
11+
---
12+
![Red Hat Ansible Automation](../images/rh-ansible-automation.png)

demos/chatops/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

demos/chatops/README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
# CHATOPS DEMO
1+
# CHATOPS DEMO
2+
23
The objective of this demo is to familiarize the network engineer with integrating a chat tool like "Slack" as an interface to the managed network devices.
34

45
**AUDIENCE**: Network engineers/systems engineers trying to integrate slack into their day-to-day operations to manage end devices
56

67
**USE CASE**: The scenario for this demo is as follows :-
78

8-
1. Network engineer gets a ticket from her customer requesting to open TCP/UDP/IP traffic from source IP (A) to destination IP (B) on some destination port X.
9-
9+
1. Network engineer gets a ticket from her customer requesting to open TCP/UDP/IP traffic from source IP (A) to destination IP (B) on some destination port X.
10+
1011
2. The first step in the manual process is for the network engineer to crawl through devices in the path between A and B and check whether the traffic is already permitted.
11-
12+
1213
3. Allow/Disallow the traffic per IT policy
1314

1415
In particular, we will use Ansible and Slack to automate step 2 via this demo.
@@ -73,7 +74,7 @@ Add an "interactive component". This is the URI invoked (HTTP POST), when the fo
7374

7475
![](./images/interactive2.png)
7576

76-
Similar to the previous step, add a url that contains the public IP/DNS name of the tower instance provisioned per the pre-requisites.
77+
Similar to the previous step, add a url that contains the public IP/DNS name of the tower instance provisioned per the pre-requisites.
7778

7879
>Note 1: The app server is preconfigured to listen on port 8888. Ensure that the URL is constructed with that port number. For example: http://34.207.200.32:8888/interactive or http://student11.mydemo.rhdemo.io:8888/collect-data
7980
>Note 2: Use a meaningful URI for the interactive component and make sure to note down the name. We will need this later.
@@ -91,29 +92,29 @@ Incoming webhooks allow the tower job to communicate back into the slack channel
9192

9293
### STEP 5: Create the bot
9394

94-
Next create the bot associated with this app.
95+
Next create the bot associated with this app.
9596

9697
![](./images/addbotuser1.png)
9798

9899
![](./images/addbotuser2.png)
99100

100101
### STEP 6: Add the app to the slack channel created in step 1
101102

102-
This step is done from within the slack client/browser
103+
This step is done from within the slack client/browser
103104

104105
![](./images/add_app1.png)
105106

106107
![](./images/add_app2.png)
107108

108-
After adding the app, ensure that the slash command is now available (it shows up)
109+
After adding the app, ensure that the slash command is now available (it shows up)
109110

110111
![](./images/add_app3.png)
111112

112113
### STEP 7: Slack App and Bot Tokens
113114

114115
Finally, switch back to the app configuration in the browser and collect the App and Bot tokens.
115116

116-
For the App verification token, navigate to the "Basic Information" link
117+
For the App verification token, navigate to the "Basic Information" link
117118

118119
![](./images/token.png)
119120

@@ -134,7 +135,7 @@ We will need this for our Python app to communicate with the slack app/bot.
134135
[student2@ansible ~]$ cd ~/demos/chatops/demo_setup/
135136
[student2@ansible demo_setup]$ pwd
136137
/home/student2/demos/chatops/demo_setup
137-
[student2@ansible demo_setup]$
138+
[student2@ansible demo_setup]$
138139
```
139140

140141
2. Edit/Create a file called `input_vars.yaml` and add the information collected in the previous steps into this file:
@@ -189,11 +190,11 @@ ok: [localhost]
189190

190191
At this point, the demo should be all set up to work. Test this by going to the slack channel and using the "slash" command you created.
191192

192-
![](./images/demo1.png )
193+
![](./images/demo1.png )
193194

194195
Enter the following values to test this:
195196

196-
![](./images/demo2.png )
197+
![](./images/demo2.png )
197198

198199
This fires of an Ansible Tower job for you!
199200

@@ -212,5 +213,5 @@ This playbook runs and generates a report that is then sent back to the Slack ch
212213

213214
## Conclusion
214215

215-
Feel free to login to the routers and add additional acls entries and test them via the slack interface.
216+
Feel free to login to the routers and add additional acls entries and test them via the slack interface.
216217
This demo shows you how flexible Ansible Tower can be for integrating with modern DevOps tools and interaction tools like Slack, allowing network administrators to literally "Chat" with their managed end points.

demos/networking/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Networking Demos
2+
3+
For now, please refer to the github link: [https://github.com/ansible/workshops/tree/master/demos/networking](https://github.com/ansible/workshops/tree/master/demos/networking)
File renamed without changes.
Lines changed: 28 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,67 @@
1-
# ServiceNow Demo for Linklight
1+
# Ansible + ServiceNow - Config Drift
22

3-
## Table of Contents
4-
- [Setup](#setup)
5-
- [Demo 01 - Config Drift](#Demo-01-Config-Drift)
6-
- [Explanation](#explanation)
7-
8-
## Setup
9-
10-
- Setup a free account
11-
https://developer.servicenow.com/
12-
13-
- Click **Manage** and create an instance
14-
15-
![manage](images/manage.png)
16-
17-
A URL will be provided like ```https://dev66073.service-now.com/```
18-
19-
- Login to your WebURL and reset your password.
20-
![snow](images/snow.png)
21-
22-
- Record these three pieces of information that will provide authentication.
23-
24-
| Field | Input |
25-
| -------- |:--------------------|
26-
| username | admin |
27-
| password | ThisIsAFakePassword |
28-
| instance | dev66073 |
29-
30-
**Tip 1** the instance is part the webURL e.g. https://dev66073.service-now.com/ is `dev66073`
31-
32-
**Tip 2** the password is **not** the same as your password to login to https://developer.servicenow.com/. To reset it click on **Action** and then **Reset admin password**
33-
34-
![reset](images/reset.png)
35-
36-
- Install pysnow
37-
https://pysnow.readthedocs.io/en/latest/
38-
39-
```$ pip install pysnow```
40-
41-
**Tip** When using Tower, use [this guide](https://docs.ansible.com/ansible-tower/latest/html/upgrade-migration-guide/virtualenv.html). Tower uses a virtualenv so the install changes slightly:
42-
43-
```
44-
# source /var/lib/awx/venv/ansible/bin/activate
45-
# umask 0022
46-
# pip install pysnow
47-
# deactivate
48-
49-
## Demo 01 - Config Drift
50-
51-
### Objective
3+
# Objective
524

535
Demonstrate automatic ticket creation for configuration drift. When the configuration for a Cisco CSR router doesn't match desired config, a ServiceNow ticket with relevant information will be created.
546

55-
### Guide
7+
- Ansible Playbook will check for desired configuration on rtr1
8+
- The configuration is missing, which generates a Service Now ticket indicating rtr1 is out of compliance.
569

57-
#### Preface
58-
59-
This demo is built for the Linklight workbench. To use the demo it is recommended to run the [provisioner](../../provisioner/README.md) for **networking mode**. By standardizing demos on the Linklight workbench it is easier to test and verify demos are always working. Feel free re-use any component of this demo but this demo is only supported in this fashion.
60-
61-
#### Overview
62-
63-
- Playbook will check for desired configuration on rtr1
10+
## Table of Contents
6411

65-
- The configuration is missing which generates a Service Now ticket indicating rtr1 is out of compliance.
12+
- [Step 1 - Connect to workbench](#step-1---connect-to-workbench)
13+
- [Step 2 - Provide ServiceNow credentials](#step-2---provide-servicenow-credentials)
14+
- [Step 3 - Execute Ansible Playbook](#step-3---execute-ansible-playbook)
15+
- [Step 4 - Show ServiceNow incidents](#step-4---show-servicenow-incidents)
16+
- [Explanation](#explanation)
6617

67-
#### Step 1
18+
## Step 1 - Connect to workbench
6819

69-
Connect to the Linklight workbench:
20+
Connect to the workshop workbench:
7021

7122
```
72-
[user@RHEL ~]$ ssh [email protected]
73-
[email protected]'s password:
23+
[user@RHEL ~]$ ssh [email protected]
24+
[email protected]'s password:
25+
7426
```
7527

76-
Move into the `demos/servicenow` directory.
28+
Move into the `demos/servicenow/1-config-drift` directory.
7729

7830
```
7931
[student1@ansible ~]$
80-
[student1@ansible ~]$ cd demos/servicenow
32+
[student1@ansible ~]$ cd ~/demos/servicenow/1-config-drift
8133
```
8234

8335

84-
#### Step 2
36+
## Step 2 - Provide ServiceNow credentials
8537

86-
Define the login information (username, password and instance) as defined in the [Setup](#setup). Fill this information out in `login_info.yml` with your text editor of choice.
38+
Define the login information (username, password and instance) as defined in the [Common Setup](../README.md). Fill this information out in `login_info.yml` with your text editor of choice.
8739

8840
```
8941
[student1@ansible ~]$ nano login_info.yml
9042
```
9143

92-
#### Step 3
44+
## Step 3 - Execute Ansible Playbook
9345

9446
Run the `config_drift.yml` playbook:
9547

9648
```
9749
[student1@ansible ~]$ ansible-playbook config_drift.yml
9850
```
9951

100-
![snow](images/snow.gif)
52+
![snow](../images/snow.gif)
10153

102-
#### Step 3
54+
# Step 4 - Show ServiceNow incidents
10355

10456
- Login to the Web URL
10557
e.g. `https://dev66073.service-now.com/`
10658
- Click the Incidents link on the left menu
10759
- The Incident just created will show up at the top of the list, assigned to the `System Administrator` which is the default user for the ServerNow developer instance.
10860
- Scroll down to to read the `Short Desription` and the `Additional Comments`.
10961

110-
![snow](images/gui.gif)
62+
![snow](../images/gui.gif)
11163

112-
#### Explanation
64+
## Explanation
11365

11466
The Ansible Playbook runs a task to configure a Cisco CSR router.
11567

@@ -168,4 +120,7 @@ Here is a snippet of ServiceNow task:
168120
169121
The block uses the conditional `when` to only run if the previous task **changed**. This means a ServiceNow ticket is only generated if the task actually reports changed.
170122

171-
# End of Demo
123+
## End of Demo
124+
125+
---
126+
![Red Hat Ansible Automation](../../../images/rh-ansible-automation.png)

0 commit comments

Comments
 (0)