Ansible and cowsay


Cowsay is one of those packages you just end up installing randomly on just about any client over time.

And if your using ansible you may be in for a little surprise:

____________
< PLAY [all] >
------------
        \   ^__^
        \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

If you don’t like this you can disable it by setting ANSIBLE_NOCOWS=1 either for a specific run or in your shells profile.

But I tend to agree with the documentation on this one.

If you have cowsay installed but want to avoid the ‘cows’ (why????), use this.

ANSIBLE_NOCOWS=1 ansible-playbook play.yml

If you like a little surprise every time you run a playbook you could also set it to random, which will choose one of the available cowsay characters for each playbook run.

ANSIBLE_COW_SELECTION=random ansible-playbook play.yml

Or you could limit it to a subset of available characters with ANSIBLE_COW_ACCEPTLIST.

Engineers having fun

I think this is a great example of engineers just having fun with a feature that doesn’t have to exist, but brings so much joy when you discover it.

If you are curious: Here is the code that selects the right cowsay, the PRs around it are a joy to read, especially this one. And of course there are test cases for it.

See also