Ansible cowsay: Die sprechende Kuh, oder auch mehr Getier ...

Bild: Ansible Logo

Dass Admins zuweilen einen besonderen Humor haben und sich an doch sonderlichen Dingen erfreuen können, hat auch beim Thema Ansible seinen Platz gefunden: cowsay, die sprechende Kuh.

Der ein oder andere wird sich nun vielleicht fragen: Was? Noch nie davon gehört noch nie gesehen.

Nun, die Ausgabe bei einem Ansible-Playbook lauf kennen wir ja nun schon zu genüge, die Ausgabe hier ist altbekannt:

 $ ansible-playbook ~/ansible/playbooks/ssh_client_config.yml


PLAY [ssh_client_config.yml] ******************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************
ok: [localhost]

TASK [ssh_client : include_tasks] *************************************************************************************************
included: /home/django/ansible/roles/ssh_client/tasks/client_config.yml for localhost

TASK [ssh_client : Generieren und kopieren der SSH Client Konfiguration ~/.ssh/config.] *******************************************
ok: [localhost]

PLAY RECAP *************************************************************************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Lassen wir es doch mal von der Kuh erklären, dann sieht sowas schon anders aus. =)

 ______________________________
< PLAY [ssh_client_config.yml] >
 ------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

 ________________________
< TASK [Gathering Facts] >
 ------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

ok: [localhost]
 ___________________________________
< TASK [ssh_client : include_tasks] >
 -----------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

included: /home/django/ansible/roles/ssh_client/tasks/client_config.yml for localhost
 ___________________________________________________________
/ TASK [ssh_client : Generieren und kopieren der SSH Client \
\ Konfiguration ~/.ssh/config.]                             /
 -----------------------------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

ok: [localhost]
 ____________
< PLAY RECAP >
 ------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
                
PLAY RECAP *************************************************************************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Wie kommt man nun zu dieser netten und spaßigen Kuh. Nun ganz einfach, wie installieren einfach das Paket cowsay.

  • Arch :
     $ pacman -S cowsay
  • Fedora / RHEL :
     # yum install cowsay
  • Gentoo :
     # emerge -av cowsay
  • openSUSE :
     $ sudo zypper in cowsay
  • Ubuntu / Debian :
     $ sudo apt-get install cowsay

Wie es sich natürlich für jedes richtige Programm gehört, verfügt cowsay selbstverständlich auch über eine entsprechende man-page!

 $ man cowsay
COWSAY(6)                                                Games Manual                                                COWSAY(6)

NAME
       cowsay/cowthink - configurable speaking/thinking cow (and a bit more)

SYNOPSIS
       cowsay [-e eye_string] [-f cowfile] [-h] [-l] [-n] [-T tongue_string] [-W column] [-bdgpstwy]

DESCRIPTION
       Cowsay generates an ASCII picture of a cow saying something provided by the user.  If run with no arguments, it accepts
       standard input, word-wraps the message given at about 40 columns, and prints the cow saying the given message on  stan‐
       dard output.

       To  aid  in  the use of arbitrary messages with arbitrary whitespace, use the -n option.  If it is specified, the given
       message will not be word-wrapped.  This is possibly useful if you want to make the cow think or speak in figlet(6).  If
       -n is specified, there must not be any command-line arguments left after all the switches have been processed.

       The -W specifies roughly where the message should be wrapped.  The default is equivalent to -W 40 i.e. wrap words at or
       before the 40th column.

       If any command-line arguments are left over after all switches have been processed, they become the cow's message.  The
       program will not accept standard input for a message in this case.

       There  are several provided modes which change the appearance of the cow depending on its particular emotional/physical
       state.  The -b option initiates Borg mode; -d causes the cow to appear dead; -g invokes greedy mode; -p causes a  state
       of  paranoia to come over the cow; -s makes the cow appear thoroughly stoned; -t yields a tired cow; -w is somewhat the
       opposite of -t, and initiates wired mode; -y brings on the cow's youthful appearance.

       The user may specify the -e option to select the appearance of the cow's eyes, in which case the first  two  characters
       of  the  argument  string  eye_string  will  be used.  The default eyes are 'oo'.  The tongue is similarly configurable
       through -T and tongue_string; it must be two characters and does not appear by default.  However, it does appear in the
       'dead' and 'stoned' modes.  Any configuration done by -e and -T will be lost if one of the provided modes is used.

       The  -f  option specifies a particular cow picture file (``cowfile'') to use.  If the cowfile spec contains '/' then it
       will be interpreted as a path relative to the current directory.  Otherwise, cowsay will search the path  specified  in
       the COWPATH environment variable.  To list all cowfiles on the current COWPATH, invoke cowsay with the -l switch.

       If the program is invoked as cowthink then the cow will think its message instead of saying it.

COWFILE FORMAT
       A  cowfile  is  made  up  of a simple block of perl(1) code, which assigns a picture of a cow to the variable $the_cow.
       Should you wish to customize the eyes or the tongue of the cow, then the variables $eyes and $tongue may be used.   The
       trail  leading  up  to  the cow's message balloon is composed of the character(s) in the $thoughts variable.  Any back‐
       slashes must be reduplicated to prevent interpolation.  The name of a cowfile should end with .cow, otherwise it is as‐
       sumed not to be a cowfile.  Also, at-signs (``@'') must be backslashed because that is what Perl 5 expects.

COMPATIBILITY WITH OLDER VERSIONS
       What older versions? :-)

       Version  3.x  is fully backward-compatible with 2.x versions.  If you're still using a 1.x version, consider upgrading.
       And tell me where you got the older versions, since I didn't exactly put them up for world-wide access.

       Oh, just so you know, this manual page documents version 3.03 of cowsay.

ENVIRONMENT
       The COWPATH environment variable, if present, will be used to search for cowfiles.  It contains a colon-separated  list
       of  directories, much like PATH or MANPATH.  It should always contain the /usr/share/cowsay/cows directory, or at least
       a directory with a file called default.cow in it.

FILES
       /usr/share/cowsay/cows holds a sample set of cowfiles.  If your COWPATH is not explicitly set,  it  automatically  con‐
       tains this directory.

BUGS
       If there are any, please notify the author at the address below.

AUTHOR
       Tony  Monroe  (tony@nog.net),  with suggestions from Shannon Appel (appel@CSUA.Berkeley.EDU) and contributions from An‐
       thony Polito (aspolito@CSUA.Berkeley.EDU).

SEE ALSO
       perl(1), wall(1), nwrite(1), figlet(6)

                                                 $Date: 1999/11/04 19:50:40 $                                        COWSAY(6)

Will man keine Kuh mehr sehen, dann kann man diese temporär durch Nutzung der Option ANSIBLE_NOCOWS=1 beim Aufruf eines Playbook unterdrücken.

 $ ANSIBLE_NOCOWS=1 ansible-playbook playbooks/ssh_client_config.yml

Dauerhaft kann man natürlich das Paket wieder deinstallieren bzw. in der Ansible-Konfigurationsdatei den Parameter nocows = True setzen.

 $ vim ~/.ansible.cfg
~/.ansible.cfg
...
 
[defaults]
nocows          = True
 
...

Ist man der Kuh überdrüssig, kann man sich auch einiges anderes Getier auf den Bildschirm holen. Was es alles gibt findet man mit dem Befehl cowsay -l heraus.

 $ cowsay -l
Cow files in /usr/share/cowsay/cows:
apt bud-frogs bunny calvin cheese cock cower daemon default dragon
dragon-and-cow duck elephant elephant-in-snake eyes flaming-sheep fox
ghostbusters gnu hellokitty kangaroo kiss koala kosh luke-koala
mech-and-cow milk moofasa moose pony pony-smaller ren sheep skeleton
snowman stegosaurus stimpy suse three-eyes turkey turtle tux unipony
unipony-smaller vader vader-koala www

Der SUSE-Enthusiast wird sich vermutlich an der Option suse erfreuen:

 ________________________
< TASK [Gathering Facts] >
 ------------------------
  \
   \____
  /@    ~-.
  \/ __ .- |
   // //  @

Auch der Kandidat hier, ist sicherlich den allermeisten wohl bekannt…

 ___________________________________________________________
/ TASK [ssh_client : Generieren und kopieren der SSH Client \
\ Konfiguration ~/.ssh/config.]                             /
 -----------------------------------------------------------
  \
   \
    ."'=-,     ,.,.,_
   (_____ )."=`      `"=,
  ./_ _  \`\             `;..
 / (o(o) |\=\              ; `;
(_/|     | \ |             ;`"`
   |     |  `             ;
   \ ..  /`,_          _.'
    `---'   `#"#""'"#'#^
             # #    # #  
             # #    # #
             # #    # #
            /#|#\  /#|#\

ok: [localhost]

… und mein ganz persönlicher Favorit:

 ______________________________
< PLAY [ssh_client_config.yml] >
 ------------------------------
 \
  \ 
   ,=""=,
  c , _,{
  /\  @ )                 __
 /  ^~~^\          <=.,__/ '}=
(_/ ,, ,,)          \_ _>_/~
 ~\_(/-\)'-,_,_,_,-'(_)-(_) 

O.K., warum gibt es das überhaupt?

Warum nicht? cowsay ist ein bisschen Spass in einer Umgebung, die normalerweise ziemlich „trocken“ und langweilig ist. Die Option ANSIBLE_COW_SELECTION=random bringt wie der Namen schon sagt, zufällige ASCII-Geschöpfe auf den Bildschirm - Langeweile kommt so nicht auf - O.K. beim Ausmachen eines grossen Mehrwerts wird man sich vermutlich auch schwer tun. Aber ein wenig Spass muss auch ab und an sein, oder? :-P

Links

Diese Website verwendet Cookies. Durch die Nutzung der Website stimmen Sie dem Speichern von Cookies auf Ihrem Computer zu. Außerdem bestätigen Sie, dass Sie unsere Datenschutzbestimmungen gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website.Weitere Information
  • linux/ansible/playbook_example_12.txt
  • Zuletzt geändert: 27.09.2022 13:24.
  • von django