LoginSignup
13

More than 5 years have passed since last update.

AnsibleのPlaybook実行時に牛とゆかいな仲間たちを表示させる

Posted at

1.準備

cowsayという牛が表示されるツールをインストールします。
(参考:コマンドラインにイラストを

Ubuntuの場合:

apt-get install cowsay

RedHat系の場合:

yum install cowsay

基本的な準備は以上です。

2. Playbookの実行

2.1 普通に表示

ansibleではcowsayがインストールさている環境ではデフォルト
playbook実行時に牛が表示されるようになります。
なので普通に実行するだけです。

実行例
user@ubuntu-vm:/etc/ansible$ ansible-playbook cat_pass.yml
 ______________
< PLAY [cisco] >
 --------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

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

略

2.2 ゆかいな仲間たちも表示させたい

「牛だけじゃ飽きる」という方は、もっといろんな種類を表示させるには
ansible.cfgに以下の設定を追加します。

ansible.cfg
[defaults]
cow_selection = random

この状態で、もう一度実行してみます。

実行例(ランダム表示板)
user@ubuntu-vm:/etc/ansible$ ansible-playbook cat_pass.yml
 ______________
< PLAY [cisco] >
 --------------
   \
    \
    ____
   /# /_\_
  |  |/o\o\
  |  \\_/_/
 / |_   |
|  ||\_ ~|
|  ||| \/
|  |||_
 \//  |
  ||  |
  ||_  \
  \_|  o|
  /\___/
 /  ||||__
    (___)_)

 ________________________
< TASK [change password] >
 ------------------------
     \
      \
          oO)-.                       .-(Oo
         /__  _\                     /_  __\
         \  \(  |     ()~()         |  )/  /
          \__|\ |    (-___-)        | /|__/
          '  '--'    ==`-'==        '--'  '

changed: [192.168.1.13]
 ______________
< TASK [DEBUG] >
 --------------
   \         ,        ,
    \       /(        )`
     \      \ \___   / |
            /- _  `-/  '
           (/\/ \ \   /\
           / /   | `    \
           O O   ) /    |
           `-^--'`<     '
          (_.)  _  )   /
           `.___/`    /
             `-----' /
<----.     __ / __   \
<----|====O)))==) \) /====
<----'    `--' `.__,' \
             |        |
              \       /
        ______( (_  / \______
      ,'  ,-----'   |        \
      `--{__________)        \/
略

これなら飽きなそうです。

3. そもそも表示させたくない場合

ansible.cfgに以下の設定をしておきます。

ansible.cfg
[defaults]

nocows=1

オライリーの「初めてのAnsible」の表紙も牛ですし、
牛を表示させておくのもよいと思います。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13