Today were going to look at what it takes to get started with chatops and how we can use chatops to make the management of Cisco ACI a little easier!
To start we will need an instance of Cisco ACI – I use ACI Simulator – If you have a lab that’s even better. We’ll also need a fresh Linux installation to install StackStorm on. Your StackStorm server needs at least 4GB of RAM. I am using CentOS8. I believe you can use any modern Linux distro that uses systemd. You’ll also either need to be the administrator of your Slack account or you can create your own for free.
Install StackStorm. This is an easy one-liner but it takes a little while so be patient.
bash <(curl -sSL https://stackstorm.com/packages/install.sh) --user=st2admin --password=Ch@ngeMe

That was easy!
Now we need to configure Slack.
First, create a dedicated channel you will use for chatops. I named the channel chatops.

In Slack we need to create what is now known as a classic app. Slack has created a new permissions system which has not been incorporated into StackStorm’s chatops system.
https://api.slack.com/authentication/migration#classic

Create a classic Slack app. I named mine aci-chatops.

We need to add the Bots features and functionality.

Add a legacy bot user

Give it a name.

Install it to your workspace.

Grant the app the permissions it needs.

Next you will be presented with two API keys. Our StackStorm configuration needs the Bot User OAuth Token.

Copy this to your clipboard.
On your StackStorm server edit the file /opt/stackstorm/chatops/st2chatops.env Find the following settings and uncomment export HUBOT_ADAPTER=slack and export HUBOT_SLACK_TOKEN={{TOKEN}}. Add your token to the second line. Save the file.
# Slack settings (https://github.com/slackhq/hubot-slack):
#
export HUBOT_ADAPTER=slack
# Obtain the Slack token from your app page at api.slack.com, it's the "Bot
# User OAuth Access Token" in the "OAuth & Permissions" section.
export HUBOT_SLACK_TOKEN=xoxb-925699564723-1895646858775-0Ebb114OZpSeHbYNGmME5CTK
# Uncomment the following line to force hubot to exit if disconnected from slack.
# export HUBOT_SLACK_EXIT_ON_DISCONNECT=1
Start ChatOps and run a StackStorm command to register ChatOps.
systemctl start st2chatops
systemctl enable st2chatops
st2ctl reload --register-all
Validate ChatOps is running as expected.
systemctl status st2chatops

Back in Slack. Add the bot you created to your channel.
In the Channel @ the bot.


We are now read to run our first command. In your channel type !help This will show us the list of available chatops commands we have right now.

The first one we are going to use is pack install. We will install the Cisco ACI Pack into StackStorm so that we can interact with ACI.
!pack install https://github.com/StackStorm-Exchange/stackstorm-cisco_aci.git
This will take about a minute to run and will let you know it has been successfully installed.

Back on the CLI of the StackStorm server we need to configure the ACI Pack and reload StackStorm to register the new pack and all of its actions. Create the configuration file
vi /opt/stackstorm/configs/cisco_aci.yaml
apic:
apic1:
address: 172.31.16.90
user: admin
passwd: P@55word
defaults:
ssl:
verify: False
st2ctl reload --register-all
Now we run the !help chatops command again and we see two new available options

To test this run the command !aci find ip 10.10.10.10 on apic1. I am using ACI Simulator so I do not have any IP addresses on my fabric right now but you can see what the return looks like.

Note that you need to specify the apic name from your configuration file. This is because our configuration file can have multiple APICs from a single fabric or even multiple APICs from multiple fabrics. That would look something like this:
apic:
fab-1-apic1:
address: 172.31.16.90
user: admin
passwd: P@55word
fab-1-apic2:
address: 172.31.16.91
user: admin
passwd: P@55word
fab-1-apic3:
address: 172.31.16.92
user: admin
passwd: P@55word
fab-2-apic1:
address: 172.31.17.90
user: admin
passwd: P@55word
fab-2-apic2:
address: 172.31.17.91
user: admin
passwd: P@55word
fab-2-apic3:
address: 172.31.17.91
user: admin
passwd: P@55word
defaults:
ssl:
verify: False
This is a quick start guide to mess around with ChatOps. In another post we’ll dive into the inner-workings of StackStorm and how it facilitates ChatOps.