タグ

ansibleとshellに関するwlbhiroのブックマーク (2)

  • Ansibleでリトライ処理をする - 雑記

    例えばAnsibleでTomcatを起動したとき、確認のためにhttpでアクセスして確認したいとします。 curlでローカルにアクセス、失敗したら数秒後に再度アクセスして確認という処理をしたかったのですが、 Ansibleでそんなのないよなーって思って探してみたらありましたよ。 Do-Until Loops http://docs.ansible.com/playbooks_loops.html#do-until-loops untilがloopから抜ける条件 retriesがリトライ回数 delayがスリープの秒数 ですね サンプル さっきの仕様を実現するとしたら以下ですね。 - shell: curl -o /dev/null -w %{http_code} http://localhost:8080/ 2> /dev/null register: result until: resu

    Ansibleでリトライ処理をする - 雑記
  • ansible commandとshellモジュールの違い - kakts-log

    ansibleで使って対象ノードで特定のコマンドを実行する際、 デフォルトで用意されているcommandモジュールとshellモジュールを使うことができます。 環境変数や、パイプを使ったコマンドを実行させる場合 この2つは挙動が異なるのでまとめてみました。 command モジュール まずはcommandモジュールについて command - Executes a command on a remote node — Ansible Documentation The given command will be executed on all selected nodes. It will not be processed through the shell, so variables like $HOME and operations like “<”, “>”, “|”, “;” an

    ansible commandとshellモジュールの違い - kakts-log
  • 1