In our last episode, we saw just how easy it was to cast a little spell with some “point-and-click” magic and have AmpCon turn some Jinja-ly auto-magically populated Jinja code into Wizard-driven menus, with your newly found Pica8 Wizardry skills. Well….now it’s time to do what all great and popular magicians do…hire an assistant! Sure it’s fun to saw your assistant in half, but how about sawing them in half with your slick Jinja code, ansible playbooks, and some basic python? That’s right, if you were lucky enough to tune-in to meet some of our assistants as part of <inserting shameless plug here> Pica8’s big reveal at Networking Field Day #28 (#NFD28).….Missed it? No problem you can watch the whole thing for FREE right HERE.
We featured some of our greatest hits:
And for the Grand Finale…wait for it…..wait for it…..wait for it…
Now, I wonder who presented this piece….I wonder…<again, shameless plug> – “REMEMBER AFTER VIEWING, TO LIKE AND SUBSCRIBE BELOW 😊 ” – Not kidding, some people actually get paid for those 😉… who knew?
Now, if you enjoyed that magical number, just wait…because we’re going to share some of the magical code used in that video…In fact, we feel…you should cut us some SLACK 😊.
Or…better…cut YOURSELF some SLACK. Like, what if you had (I’m going to borrow a term from our NFD delegates) some “ChatOps” assistance to help you speed up your daily administration and deployment chores? I bet you’d….wait for it….wait for it….wait for it….LOVE it. And what if you could…oh, I don’t know…even tell it to deploy something like EVPN-VXLAN? Wouldn’t you….ummmm….LOVE that too? I mean….after all…this is the EVPN-VXLAN Tunnel of Love…is it not?
So without further ado, meet our…errr…YOUR new Pica8 assistant:
But wait, what if I just want to have a “regular” conversation and ask it questions, in simple, plain, “natural language”?
But, of course!
So, “naturally”….the big question is…”How did they do it?”
First, you have to get an account from slack.com (they’re free to start by the way, APIs and all…for some light usage…they will throttle you if making too many successive calls on the free account….everybody gotta make $$$$…keep the instances and containers running…)
PRELIMINARY STEPS / PREP
STEP 1) Create a SLACK account and SLACK Workspace: https://slack.com/help/articles/206845317-Create-a-Slack-workspace
- Great How-To-Guide for SLACK Account and initial Bot Setup from TWILIO: https://www.twilio.com/blog/how-to-build-a-slackbot-in-socket-mode-with-python
STEP 2) Create a SLACK “APP/Channel”:
- Example SLACK “APP/Channel” creation also in Found in Guide from TWILIO above
And once you’re SLACK is ready for some bot-ness…
We thought you’d never ask….really….we never thought you’d ask….but YOU DID! Or…well…our #NFD28 colleagues did….so as promised, for some “no smoke, no mirrors” magic, check out our ever evolving and updating GitHub HERE, for some sample Pica8-filled Jinja templates, our python3 friendly ansible module, and the feeble python behind this bot.
STEP 3) “git clone” our Pica8 SLACKBOT repo here:
bash~$: git clone https://github.com/pica8/AmpCon-Automations/tree/main/pica8SLACKBot
STEP 4) Setup and install ANSIBLE.
Nice How-To-Guide here: https://adamtheautomator.com/install-ansible/
And setup your ANSIBLE hosts file: https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html
(Sample ANSIBLE hosts file supplied in the REPO 😉 https://github.com/pica8/AmpCon-Automations/blob/main/pica8SLACKBot/hosts)
STEP 6) Choose either the BOT with the “fancy” STREAMLIT-based UI to enter your Pica8 AmpCon credentials in a nice, safe, pretty browser window (https://github.com/pica8/AmpCon-Automations/blob/main/pica8SLACKBot/Pica8SLACKBot.py) or…
STEP 6A) Choose the BOT WITHOUT the “fancy” STREAMLIT-based UI, and just enter them when prompted (securely) in the CLI (https://github.com/pica8/AmpCon-Automations/blob/main/pica8SLACKBot/Pica8SLACKBot_NO_UI.py).
And of course, we’d like some assistance too, so please feel free to contribute, join our newly developing GitHub community, or please “fork us” on GitHub… (I just feel so dirty saying that but, it’s legit 😊)
Until next time….and by next time we mean “part 2” of Episode 3….
And contact us directly with any questions, comments or suggestions. We always love to hear from you.
Neal Trieber is a Senior Sales Engineer for Pica8