Senseless acts of automation


TL;DR
Possibilities can become reality…..if you just think of enough stupid things!

Truly being a Mad Scientist these days. I would always say that with stackstorm I can automate just about anything. Well, My dream has always been to tweet a vlan into my data center. Yes, you’re proably rubbing your chin saying the cheese has slid off this wookie’s cracker.
But not so fast! If you think about what you have to do to make this task happen, in an automated fashion, then maybe it’s just not so dumb after all.
We don’t want to have to pick up our phone a tweet every time we want to test our app, do we? So we start with the fun little app to send a tweet for us.
tweet
It’s OK security buffs, I changed the oAuth token…Next we are going to have to make a stackstorm pack. It’s just a bunch of folders so we can keep everything together.
html
Now we need to depend on the twitter sensor so we need to install the st2 pack. st2 pack install twitter. In the sensor folder we will find the sensor, it looks like this.
html
You can see where it wants the oAuth token. So we add that information to the configs directory like this:
html
Now with the sensor kicks out a trigger for a matched tweet, our rule will “fire”
html
That rule will can for a st2 action to run. In this case it’s a workflow. Heres a look at the YAML file.
html
Looking at this file we can see that it has a runner type of Orquesta. That means it’s going to run a st2 workflow, like this:
html
There are two tasks in the workflow. The first is to format the tweet and get the information we want, the vlan numbers. The second will send three variables over to the stackstorm-hpe-cfm pack and run an action to POST a vlan to the CFM fabric.
html
The YAML file tells the python what variables are coming and then the python script will match to my twitter handle.
html

Finally, 3 variables are sent to the hpecfm.post_vlan st2 action. So, that my friends is how you can tweet vlans into your data center fabric. Absolutely crazy!

Leave a Reply