Skip to content

Commit

Permalink
Merge pull request #414 from ansible/devel
Browse files Browse the repository at this point in the history
Release September 9th, 2019
  • Loading branch information
IPvSean authored Sep 10, 2019
2 parents e0e6a39 + 8a09a88 commit 262f154
Show file tree
Hide file tree
Showing 103 changed files with 2,676 additions and 861 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ demos/servicenow/closed_loop_incident_mgmt/snow_demo2/snow_vars.yaml
provisioner/roles/ansible_security.ids_config/
provisioner/roles/ansible_security.ids_install/
provisioner/roles/geerlingguy.repo-epel/
.pyc
.swp
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ The Red Hat Ansible Automation Workshops project is intended for effectively dem

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

# Demos

- [Demos](demos) - These demos are intended for effectively demonstrating Ansible capabilities with prescriptive guides on the Ansible Automation Workshop infrastructure.

# DOCUMENTATION:

- [How to contribute](docs/contribute.md)
Expand Down
1 change: 0 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ theme: jekyll-theme-dinky
include:
- "provisioner/README.md"
exclude:
- "demos/*"
- "provisioner/roles"
- "provisioner/group_vars"
- "provisioner/inventory"
12 changes: 12 additions & 0 deletions demos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Demos

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.

| Demo Category | Brief Description |
|---|---|
| [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. |
| [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. |
| [Ansible + ServiceNow](servicenow) | These demos are intended for effectively demonstrating Ansible + ServiceNow capabilities with prescriptive guides on the Ansible Automation Workshop infrastructure. |

---
![Red Hat Ansible Automation](../images/rh-ansible-automation.png)
3 changes: 0 additions & 3 deletions demos/chatops/.gitignore

This file was deleted.

27 changes: 14 additions & 13 deletions demos/chatops/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# CHATOPS DEMO
# CHATOPS DEMO

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.

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

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

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.
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.

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.

3. Allow/Disallow the traffic per IT policy

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

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

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

>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
>Note 2: Use a meaningful URI for the interactive component and make sure to note down the name. We will need this later.
Expand All @@ -91,29 +92,29 @@ Incoming webhooks allow the tower job to communicate back into the slack channel

### STEP 5: Create the bot

Next create the bot associated with this app.
Next create the bot associated with this app.

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

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

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

This step is done from within the slack client/browser
This step is done from within the slack client/browser

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

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

After adding the app, ensure that the slash command is now available (it shows up)
After adding the app, ensure that the slash command is now available (it shows up)

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

### STEP 7: Slack App and Bot Tokens

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

For the App verification token, navigate to the "Basic Information" link
For the App verification token, navigate to the "Basic Information" link

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

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

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

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.

![](./images/demo1.png )
![](./images/demo1.png )

Enter the following values to test this:

![](./images/demo2.png )
![](./images/demo2.png )

This fires of an Ansible Tower job for you!

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

## Conclusion

Feel free to login to the routers and add additional acls entries and test them via the slack interface.
Feel free to login to the routers and add additional acls entries and test them via the slack interface.
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.
3 changes: 3 additions & 0 deletions demos/networking/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Networking Demos

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.
101 changes: 28 additions & 73 deletions demos/servicenow/1-config-drift/README.md
Original file line number Diff line number Diff line change
@@ -1,115 +1,67 @@
# ServiceNow Demo for Linklight
# Ansible + ServiceNow - Config Drift

## Table of Contents
- [Setup](#setup)
- [Demo 01 - Config Drift](#Demo-01-Config-Drift)
- [Explanation](#explanation)

## Setup

- Setup a free account
https://developer.servicenow.com/

- Click **Manage** and create an instance

![manage](images/manage.png)

A URL will be provided like ```https://dev66073.service-now.com/```

- Login to your WebURL and reset your password.
![snow](images/snow.png)

- Record these three pieces of information that will provide authentication.

| Field | Input |
| -------- |:--------------------|
| username | admin |
| password | ThisIsAFakePassword |
| instance | dev66073 |

**Tip 1** the instance is part the webURL e.g. https://dev66073.service-now.com/ is `dev66073`

**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**

![reset](images/reset.png)

- Install pysnow
https://pysnow.readthedocs.io/en/latest/

```$ pip install pysnow```

**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:

```
# source /var/lib/awx/venv/ansible/bin/activate
# umask 0022
# pip install pysnow
# deactivate
## Demo 01 - Config Drift
### Objective
# Objective

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.

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

#### Preface
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.
#### Overview
- Playbook will check for desired configuration on rtr1
## Table of Contents

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

#### Step 1
## Step 1 - Connect to workbench

Connect to the Linklight workbench:
Connect to the workshop workbench:

```
[user@RHEL ~]$ ssh student1@X.X.X.X
student1@X.X.X.X's password:
[user@RHEL ~]$ ssh student1@student1.workshop.rhdemo.io
student1@student1.workshop.rhdemo.io's password:
```

Move into the `demos/servicenow` directory.
Move into the `demos/servicenow/1-config-drift` directory.

```
[student1@ansible ~]$
[student1@ansible ~]$ cd demos/servicenow
[student1@ansible ~]$ cd ~/demos/servicenow/1-config-drift
```


#### Step 2
## Step 2 - Provide ServiceNow credentials

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.
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.

```
[student1@ansible ~]$ nano login_info.yml
```

#### Step 3
## Step 3 - Execute Ansible Playbook

Run the `config_drift.yml` playbook:

```
[student1@ansible ~]$ ansible-playbook config_drift.yml
```

![snow](images/snow.gif)
![snow](../images/snow.gif)

#### Step 3
# Step 4 - Show ServiceNow incidents

- Login to the Web URL
e.g. `https://dev66073.service-now.com/`
- Click the Incidents link on the left menu
- 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.
- Scroll down to to read the `Short Desription` and the `Additional Comments`.

![snow](images/gui.gif)
![snow](../images/gui.gif)

#### Explanation
## Explanation

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

Expand Down Expand Up @@ -168,4 +120,7 @@ Here is a snippet of ServiceNow task:
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.

# End of Demo
## End of Demo

---
![Red Hat Ansible Automation](../../../images/rh-ansible-automation.png)
Loading

0 comments on commit 262f154

Please sign in to comment.