Skip to content

Commit

Permalink
Merge pull request #280 from nautobot/develop
Browse files Browse the repository at this point in the history
Release 3.0.0
  • Loading branch information
smk4664 authored Sep 29, 2023
2 parents 1d7365d + ff8e139 commit b7818ee
Show file tree
Hide file tree
Showing 92 changed files with 1,692 additions and 1,374 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,22 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10"]
nautobot-version: ["1.6.2", "stable"]
python-version: ["3.8"]
db-backend: ["postgresql", "mysql"]
nautobot-version: ["2.0.0"]
# The include is a method to limit the amount of jobs ran. This essentially
# means that in addition to standard postgres and stable, also the lowest
# supported version and with mysql
include:
- python-version: "3.11"
db-backend: "postgresql"
nautobot-version: "2.0.0"
- python-version: "3.11"
db-backend: "postgresql"
nautobot-version: "stable"
- python-version: "3.11"
db-backend: "mysql"
nautobot-version: "stable"
runs-on: "ubuntu-20.04"
env:
INVOKE_NAUTOBOT_CHATOPS_PYTHON_VER: "${{ matrix.python-version }}"
Expand Down Expand Up @@ -150,7 +164,7 @@ jobs:
- name: "Upload binaries to release"
uses: "svenstaro/upload-release-action@v2"
with:
repo_token: "${{ secrets.NTC_GITHUB_TOKEN }}"
repo_token: "${{ secrets.GH_NAUTOBOT_BOT_TOKEN }}"
file: "dist/*"
tag: "${{ github.ref }}"
overwrite: true
Expand Down
3 changes: 2 additions & 1 deletion development/development.env
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ MYSQL_ROOT_HOST=%

# = ChatOps Common Settings ==========
NAUTOBOT_CHATOPS_RESTRICT_HELP="False"
NAUTOBOT_CHATOPS_FALLBACK_CHATOPS_USER="chatbot"

# = Chat Platforms ===================

Expand All @@ -65,7 +66,7 @@ NAUTOBOT_CHATOPS_ENABLE_WEBEX="False"
NAUTOBOT_CHATOPS_ENABLE_ACI="False"

# - AWX / Ansible Tower --------------
NAUTOBOT_CHATOPS_ENABLE_ANSIBLE="True"
NAUTOBOT_CHATOPS_ENABLE_ANSIBLE="False"
NAUTOBOT_TOWER_URI="https://awx:8043/"
NAUTOBOT_TOWER_USERNAME="awx"
NAUTOBOT_TOWER_VERIFY_SSL="False"
Expand Down
17 changes: 17 additions & 0 deletions development/docker-compose.socket.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
version: "3.8"
services:
socket:
image: "nautobot-chatops-plugin/nautobot:${NAUTOBOT_VER}-py${PYTHON_VER}"
env_file:
- "development.env"
- "creds.env"
tty: true
entrypoint: "nautobot-server start_slack_socket"
depends_on:
- "nautobot"
healthcheck:
disable: true
volumes:
- "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
- "../:/source"
2 changes: 1 addition & 1 deletion development/mattermost/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
worker:
<<: *nautobot
mattermost:
image: "mattermost/mattermost-preview"
image: "mattermost/mattermost-preview:7.8.9"
hostname: "mattermost"
environment:
MM_LOGSETTINGS_SENDCRASHREPORTS: "false"
Expand Down
26 changes: 24 additions & 2 deletions development/mattermost/nautobot_bootstrap.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
"""Bootstrap script for Nautobot to allow Mattermost integration."""

from nautobot_chatops.models import AccessGrantTypeChoices, CommandTokenPlatformChoices, AccessGrant, CommandToken

import contextlib
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist

from nautobot_chatops.models import (
AccessGrantTypeChoices,
PlatformChoices,
AccessGrant,
CommandToken,
ChatOpsAccountLink,
)


User = get_user_model()

for grant_type in AccessGrantTypeChoices.values():
AccessGrant.objects.update_or_create(
Expand All @@ -26,7 +40,15 @@

for command, token in _COMMAND_TOKENS.items():
CommandToken.objects.update_or_create(
platform=CommandTokenPlatformChoices.MATTERMOST,
platform=PlatformChoices.MATTERMOST,
comment=command,
token=token,
)

with contextlib.suppress(ObjectDoesNotExist):
admin = User.objects.get(name="admin")
ChatOpsAccountLink.objects.update_or_create(
user_id="jactwicuqb8bu8pau8mgjydzeo",
platform=PlatformChoices.MATTERMOST,
defaults={"nautobot_user": admin},
)
1 change: 1 addition & 0 deletions development/nautobot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"nautobot_chatops": {
# = Common Settings ==================
"restrict_help": is_truthy(os.getenv("NAUTOBOT_CHATOPS_RESTRICT_HELP")),
"fallback_chatops_user": os.environ.get("NAUTOBOT_CHATOPS_FALLBACK_CHATOPS_USER"),
# TODO: Add following settings
# | `delete_input_on_submission` | Removes the input prompt from the chat history after user input | No | `False` |
# | `send_all_messages_private` | Ensures only the person interacting with the bot sees the responses | No | `False` |
Expand Down
1 change: 1 addition & 0 deletions docs/admin/compatibility_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ While that last supported version will not be strictly enforced via the `max_ver
| 1.10.X | 1.3.0 | 1.5.99 [Official] |
| 2.0.X | 1.5.4 | 1.6.99 [Official] |
| 2.1.X | 1.6.2 | 1.6.99 [Official] |
| 3.0.X | 2.0.0 | 2.2.99 [Official] |
8 changes: 4 additions & 4 deletions docs/admin/install/aci_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Create a top-level command named `aci` in your enabled chat platform. For detail

You must define the following values in your `nautobot_config.py` file:

| Configuration Setting | Mandatory? | Default |
| --------------------- | ---------- | ------- |
| `enable_aci` | **Yes** | False |
| `aci_creds` | **Yes** | {} |
| Configuration Setting | Mandatory? | Default | Available on Admin Config |
| --------------------- | ---------- | ------- | ------------------------- |
| `enable_aci` | **Yes** | False | Yes |
| `aci_creds` | **Yes** | {} | No |

Below is an example snippet from `development/nautobot_config.py` that demonstrates how to enable and configure Cisco ACI integration:

Expand Down
14 changes: 7 additions & 7 deletions docs/admin/install/ansible_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ Create a top-level command named `ansible` in your enabled chat platform. For de
You must define the following values in your `nautobot_config.py` file:

```
| Configuration Setting | Mandatory? | Default |
| --------------------- | ---------- | ----------- |
| `enable_ansible` | Yes | False |
| `tower_password` | No | |
| `tower_uri` | No | |
| `tower_username` | No | |
| `tower_verify_ssl` | No | True |
| Configuration Setting | Mandatory? | Default | Available on Admin Config |
| --------------------- | ---------- | ----------- | ------------------------- |
| `enable_ansible` | Yes | False | Yes |
| `tower_password` | No | | No |
| `tower_uri` | No | | No |
| `tower_username` | No | | No |
| `tower_verify_ssl` | No | True | No |
```
R: Convert each configuration item to a table row with the setting name, whether it is mandatory or not, and the default value if available.
Expand Down
20 changes: 10 additions & 10 deletions docs/admin/install/aristacv_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ Create a top-level command named `aristacv` in your enabled chat platform. For d

You must define the following values in your `nautobot_config.py` file:

| Configuration Setting | Mandatory? | Default |
| ---------------------- | ---------- | --------------------- |
| `enable_aristacv` | **Yes** | False |
| `aristacv_cvaas_url` | No | "www.arista.io:443" |
| `aristacv_cvaas_token` | No | None |
| `aristacv_cvp_host` | No | None |
| `aristacv_cvp_insecure`| No | False |
| `aristacv_cvp_password`| No | None |
| `aristacv_cvp_username`| No | None |
| `aristacv_on_prem` | No | False |
| Configuration Setting | Mandatory? | Default | Available on Admin Config |
| ---------------------- | ---------- | --------------------- | ------------------------- |
| `enable_aristacv` | **Yes** | False | Yes |
| `aristacv_cvaas_url` | No | "www.arista.io:443" | No |
| `aristacv_cvaas_token` | No | None | No |
| `aristacv_cvp_host` | No | None | No |
| `aristacv_cvp_insecure`| No | False | No |
| `aristacv_cvp_password`| No | None | No |
| `aristacv_cvp_username`| No | None | No |
| `aristacv_on_prem` | No | False | No |

Below is an example snippet from `development/nautobot_config.py` that demonstrates how to enable and configure Arista CloudVision integration:

Expand Down
22 changes: 11 additions & 11 deletions docs/admin/install/grafana_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ Create a top-level command named `grafana` in your enabled chat platform. For de

You must define the following values in your `nautobot_config.py` file:

| Configuration Setting | Mandatory? | Default | Notes |
| --------------------- | ---------- | ------- | ----- |
| `enable_grafana` | **Yes** | False | Enable Grafana integration. |
| `grafana_url` | **Yes** | | Base url that the Grafana application is hosted at. |
| `grafana_api_key` | **Yes** | | Found in `<grafana_url>/org/apikeys`. |
| `grafana_default_width` | | 0 | Grafana image width when rendered into the chat client. Default will render width dynamically. |
| `grafana_default_height` | | 0 | Grafana image height when rendered into the chat client. Default will render height dynamically. |
| `grafana_default_theme` | | dark | Theme color to use when generating rendered Grafana images. Options are [`dark`, `light`]. |
| `grafana_default_timespan` | | 0 | Timespan that data is collected on a panel in Grafana. Default action is to use the defined timespan in Grafana. |
| `grafana_org_id` | | 1 | Found in `<grafana_url>/admin/orgs`. |
| `grafana_default_tz` | | | Timezone in which the renderer will render charts and graphs in. |
| Configuration Setting | Mandatory? | Default | Notes | Available on Admin Config |
| --------------------- | ---------- | ------- | ----- | ------------------------- |
| `enable_grafana` | **Yes** | False | Enable Grafana integration. | Yes |
| `grafana_url` | **Yes** | | Base url that the Grafana application is hosted at. | No |
| `grafana_api_key` | **Yes** | | Found in `<grafana_url>/org/apikeys`. | No |
| `grafana_default_width` | | 0 | Grafana image width when rendered into the chat client. Default will render width dynamically. | No |
| `grafana_default_height` | | 0 | Grafana image height when rendered into the chat client. Default will render height dynamically. | No |
| `grafana_default_theme` | | dark | Theme color to use when generating rendered Grafana images. Options are [`dark`, `light`]. | No |
| `grafana_default_timespan` | | 0 | Timespan that data is collected on a panel in Grafana. Default action is to use the defined timespan in Grafana. | No |
| `grafana_org_id` | | 1 | Found in `<grafana_url>/admin/orgs`. | No |
| `grafana_default_tz` | | | Timezone in which the renderer will render charts and graphs in. | No |

!!! note
Grafana API key only needs to have `Viewer` permissions assigned!
Expand Down
26 changes: 20 additions & 6 deletions docs/admin/install/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This guide outlines the process of enabling Nautobot ChatOps, which includes:
- [Installation Guide](#installation-guide)
- [Configuration Guide](#configuration-guide)
- [Granting Access to the Chat Platform](#granting-access-to-the-chat-platform)
- [Link Nautobot Account](#link-nautobot-account)
- [Test Your Chatbot](#test-your-chatbot)
- [Integrations Configuration](#integrations-configuration)

Expand Down Expand Up @@ -106,16 +107,21 @@ PLUGINS_CONFIG = {
}
```

+++3.0.0

Some configuration settings have now been added to the Nautobot Admin Config page. See [Nautobot Admin](https://docs.nautobot.com/projects/core/en/stable/configuration/optional-settings/?h=administr#administratively-configurable-settings)

## Configuration Guide

Adjust the App's behavior with the following settings:

| Configuration Setting | Description | Mandatory? | Default |
| - | - | - | - |
| `delete_input_on_submission` | Removes the input prompt from the chat history after user input | No | `False` |
| `restrict_help` | Shows Help prompt only to users based on their Access Grants | No | `False` |
| `send_all_messages_private` | Ensures only the person interacting with the bot sees the responses | No | `False` |
| `session_cache_timeout` | Controls session cache | No | `86400` |
| Configuration Setting | Description | Mandatory? | Default | Available on Admin Config |
| - | - | - | - | - |
| `delete_input_on_submission` | Removes the input prompt from the chat history after user input | No | `False` | No |
| `restrict_help` | Shows Help prompt only to users based on their Access Grants | No | `False` | No |
| `send_all_messages_private` | Ensures only the person interacting with the bot sees the responses | No | `False` | No |
| `fallback_chatops_user` | Nautobot User for Chat Commands to use if the user has not linked their account | Yes | `chatbot` | Yes |
| `session_cache_timeout` | Controls session cache | No | `86400` | No |

## Granting Access to the Chat Platform

Expand All @@ -125,6 +131,14 @@ Adjust the App's behavior with the following settings:
heading-offset=1
%}

## Link Nautobot Account

{%
include-markdown '../../models/chatopsaccountlink.md'
start='<!--account-link-->'
heading-offset=1
%}

## Test Your Chatbot

Finally, test your chatbot's functionality within your chosen chat application, using a command like `/nautobot get-devices`.
Expand Down
14 changes: 7 additions & 7 deletions docs/admin/install/ipfabric_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ Create a top-level command named `ipfabric` in your enabled chat platform. For d

You must define the following values in your `nautobot_config.py` file:

| Configuration Setting | Mandatory? | Default |
| ---------------------- | ---------- | ------- |
| `enable_ipfabric` | **Yes** | False |
| `ipfabric_api_token` | **Yes** | |
| `ipfabric_host` | **Yes** | |
| `ipfabric_timeout` | | |
| `ipfabric_verify` | | True |
| Configuration Setting | Mandatory? | Default | Available on Admin Config |
| --------------------- | ---------- | ------- | ------------------------- |
| `enable_ipfabric` | **Yes** | False | Yes |
| `ipfabric_api_token` | **Yes** | | No |
| `ipfabric_host` | **Yes** | | No |
| `ipfabric_timeout` | | | No |
| `ipfabric_verify` | | True | No |

Below is an example snippet from `development/nautobot_config.py` that demonstrates how to enable and configure IPFabric integration:

Expand Down
10 changes: 5 additions & 5 deletions docs/admin/install/mattermost_setup.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Mattermost Setup

| Configuration Setting | Mandatory? | Default |
| ---------------------------- | ---------- | ------- |
| `enable_mattermost` | **Yes** | False |
| `mattermost_api_token` | **Yes** | -- |
| `mattermost_url` | **Yes** | -- |
| Configuration Setting | Mandatory? | Default | Available on Admin Config |
| ---------------------------- | ---------- | ------- | ------------------------- |
| `enable_mattermost` | **Yes** | False | Yes |
| `mattermost_api_token` | **Yes** | -- | No |
| `mattermost_url` | **Yes** | -- | No |

1. Login to your instance of Mattermost and select Integrations, then click Bot Accounts.
- Enter the bot username, icon, Display name and Description.
Expand Down
8 changes: 4 additions & 4 deletions docs/admin/install/meraki_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Create a top-level command named `meraki` in your enabled chat platform. For det

You must define the following values in your `nautobot_config.py` file:

| Configuration Setting | Mandatory? | Default |
| --------------------- | ---------- | ------- |
| `enable_meraki` | **Yes** | False |
| `meraki_dashboard_api_key` | **Yes** | |
| Configuration Setting | Mandatory? | Default | Available on Admin Config |
| --------------------- | ---------- | ------- | ------------------------- |
| `enable_meraki` | **Yes** | False | Yes |
| `meraki_dashboard_api_key` | **Yes** | | No |

Below is an example snippet from `development/nautobot_config.py` that demonstrates how to enable and configure Cisco Meraki integration:

Expand Down
10 changes: 5 additions & 5 deletions docs/admin/install/microsoft_teams_setup.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Microsoft Teams Setup

| Configuration Setting | Mandatory? | Default |
| ---------------------------- | ---------- | ------- |
| `enable_ms_teams` | **Yes** | False |
| `microsoft_app_id` | **Yes** | -- |
| `microsoft_app_password` | **Yes** | -- |
| Configuration Setting | Mandatory? | Default | Available on Admin Config |
| ---------------------------- | ---------- | ------- | --------------------------|
| `enable_ms_teams` | **Yes** | False | Yes |
| `microsoft_app_id` | **Yes** | -- | No |
| `microsoft_app_password` | **Yes** | -- | No |

## Azure

Expand Down
12 changes: 6 additions & 6 deletions docs/admin/install/panorama_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ Create a top-level command named `panorama` in your enabled chat platform. For d

You must define the following values in your `nautobot_config.py` file:

| Configuration Setting | Mandatory? | Default |
| ---------------------- | ---------- | ------- |
| `enable_panorama` | **Yes** | False |
| `panorama_host` | **Yes** | |
| `panorama_password` | **Yes** | |
| `panorama_user` | **Yes** | |
| Configuration Setting | Mandatory? | Default | Available on Admin Config |
| --------------------- | ---------- | ------- | ------------------------- |
| `enable_panorama` | **Yes** | False | Yes |
| `panorama_host` | **Yes** | | No |
| `panorama_password` | **Yes** | | No |
| `panorama_user` | **Yes** | | No |

Below is an example snippet from `development/nautobot_config.py` that demonstrates how to enable and configure Palo Alto Panorama integration:

Expand Down
17 changes: 9 additions & 8 deletions docs/admin/install/slack_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

These are the distinct configuration values you will need to configure in `nautobot_config.py`.

| Configuration Setting | Mandatory? | Default |
| ---------------------------- | ---------- | ------- |
| `enable_slack` | **Yes** | False |
| `slack_api_token` | **Yes** | -- |
| `slack_app_token` | Socket Mode| -- |
| `slack_signing_secret` | **Yes** | -- |
| `slack_slash_command_prefix` | No | `"/"` |
| `slack_socket_static_host` | No | -- |
| Configuration Setting | Mandatory? | Default | Available on Admin Config |
| ---------------------------- | ---------- | ------- | ------------------------- |
| `enable_slack` | **Yes** | False | Yes |
| `slack_api_token` | **Yes** | -- | No |
| `slack_app_token` | Socket Mode| -- | No |
| `slack_signing_secret` | **Yes** | -- | No |
| `slack_slash_command_prefix` | No | `"/"` | No |
| `slack_socket_static_host` | No | -- | No |

These values will be used in the `nautobot_config.py` file, once we get to the section where we cover server configuration.
For now, take a mental note that in this section where we are configuring the Slack application, we will need to explicitly note the
Expand Down Expand Up @@ -288,6 +288,7 @@ While this method is still possible, we recommend using the App Manifest method
- `files:write`
- `incoming-webhook`
- `users:read`
- `users:read.email`
- `app_mentions:read`
- `groups:read`
- `im:read`
Expand Down
Loading

0 comments on commit b7818ee

Please sign in to comment.