LoginSignup
18
17

More than 5 years have passed since last update.

Ansible モジュール debug

Last updated at Posted at 2016-02-03

debug

実行中にステートメントを出力する

概要

実行中にステートメントを出力するモジュール。playbookを停止せずに変数や式をデバッグするのに便利。「when:」ディレクティブと同時に使ってデバッグする際に有用である。

オプション

引数 必須 デフォルト 備考
msg no Hello world! 出力用のカスタマイズされたメッセージ。省略時、汎用的なメッセージが出力される。
var no デバッグする変数名。msg引数とお互いに排他的である。

使用例

# ホスト毎にループバックアドレスとゲートウェイを出力する
- debug: msg="System {{ inventory_hostname }} has uuid {{ ansible_product_uuid }}"

- debug: msg="System {{ inventory_hostname }} has gateway {{ ansible_default_ipv4.gateway }}"
  when: ansible_default_ipv4.gateway is defined

- shell: /usr/bin/uptime
  register: result

- debug: var=result

- name: Display all variables/facts known for a host
  debug: var=hostvars[inventory_hostname]```

Ansibleコアモジュール

このモジュールはコア・アンシブルチームによりメンテナンスされます。

18
17
0

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
18
17