Ansible Me A Sandwich

April 1, 2014 by Michael DeHaan


Ansible isn't just about deploying artifacts onto servers -- it's a general purpose automation tool!  In our last blog post, we wrote about Notification modules - a great way to signal what's going on during your IT automation process, and a fine example of interacting with other components outside of just your web farm.

Today Ansible is proud to release a new killer feature that you are guaranteed to be drooling over.

We're big fans of XKCD here, and "Sudo Make Me A Sandwich" is one of the best comics they have ever done.   (Though we are also partial to 386).  So, what's new?

Could Ansible 1.5 order you food?  No.  Can Ansible 1.6 (devel).  YES!!!!   And why not?  If we automated your ops work correctly your day with Ansible ends at 5 or 6pm. We (and our investors) would want you to be able to use Ansible all day long though.   If you finish that rolling update without error, how about getting food delivered to the conference room?  YES!  Let's do that.

So how might we do that?   You might write a shell script, but that would wrong!  Nobody wants to just write a shell script to request a sandwich - it's needlessly difficult, shell scripts are fragile, and non-idempotence may result in ordering too much food if you ran the shell script more than once to amend an order.   

You might say just use the immutable servers approach and deploy a nice pre-frozen pre-made sandwich -- but that's wrong.   A freezer burned  sandwich is no fun, you want something made to order!  (But precise!)

Starting in the development branch, there are now two easy ways to order a sandwich programmatically:

1.   Get someone to get you a sandwich.   Ansible now implements WS-HumanTask where an XML document can be defined for the process of submitting an order to a person, whether that person is a colleague, friend, or hapless intern.   Separate WS-HumanTask modules can be used to poll for status, including, technically if required, telling oneself to consume the said sandwhich, or arrange for delivery, along with, if needed, condiments, utensils, and beverages.  Since this format is XML and is very flexible, we anticipate the proper XML specification can be drafted by an informed audience in a couple of weeks or months.  If that human sandwich creator implements a web service, which most spouses and significant others will not, BPEL4People can also be used.  Just run "ansible localhost -m ws_human_task -a "xml_file=/tmp/order_specification.xml dtd_file=/tmp/sandwhich-xml-spec-303b7_2.dtd" and you are off to the races just as soon as you match all of your angle brackets and match the DTD.  Good luck! 

2.   Ok, we realized that last option was a cop-out.  A better way is to utilize a proper enterprise sandwich ordering API.   This is really a better route for most consumers as a more native API ensures better specification of a sandwich order - but decreases the types of bespoke sandwiches being ordered.   For example, the Ansible sandwich module supports the Jimmy Johns (TM) JJJSON API, where REST requests can be posted. Additionally, pizza ordering is supported in a premium enterprise version, such as using the Mello Mushroom (TM) Enterprise Service Bus (MMESB).   Just be careful and don't hook this up to your continous integration system, or you will be very full.

One upgrade Ansible has over XKCD 149's suggested protocol is that sudo access is not required, only tokens for a sandwich provider.   Alternative authentication may be implemented in a future release.   Also, a callback asking how local the ingredients are made might be made possible -- for instance, to implement assertions that a chicken in a chicken sandwich is in fact, local, free-range, non-GMO, fair-trade, solar, and had a good life.   PATCHES WILL BE ACCEPTED!

Due to extreme interest in this feature, this time limited beta is limited to users signing up on this first day of April, 2014.   Sign up here and we'll let you know if you are selected!

Related News

Deploying Highly Available OpenShift Origin Clusters | Installing and Building Docker With Ansible | Listen To Your Servers Talk | Fixing Heartbleed With Ansible | Orchestration, You Keep Using That Word

Continuous Integration


Michael DeHaan

Ansible project founder.


See All

rss-icon  RSS Feed

AF 2022 - Blog static promo