Ansible Module ansible.builtin.debug: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 6: Line 6:
Can be used to issue debug messages, in which variables can be embedded as <code>&#123;{ variable_name }}</code>.
Can be used to issue debug messages, in which variables can be embedded as <code>&#123;{ variable_name }}</code>.


=Example=
=Module Arguments=
==<tt>msg</tt>==
A string to display. Can include variable names introduced with <code>&#123;{ ... }}</code>. If the only thing to display is a variable, it must be quoted: <code>"&#123;{ var_name }}"</code>. If this is the case, consider using [[#var|var]].
<syntaxhighlight lang='yaml'>
<syntaxhighlight lang='yaml'>
- name: display the content of a variable
- name: Debug
   debug:
   debug:
     msg: Some message that refers to the content of {{ some_var }}
     msg: Some message that refers to the content of {{ some_var.some_key }}
</syntaxhighlight>
</syntaxhighlight>
=Module Arguments=
==<tt>msg</tt>==
A string to display. Can include variable names introduced with <code>&#123;{ ... }}</code>. If the only thing to display is a variable, it must be quoted: <code>"{{ var_name }}"</code>. If this is the case, consider using [[#var|var]].


==<tt>var</tt>==
==<tt>var</tt>==
A variable name to debug. Mutually exclusive with the [[#msg|msg]] option. Must not use <code>&#123;{ ... }}</code> Jinja variable delimiters.
A variable name to debug. Mutually exclusive with the [[#msg|msg]] option. Must not use <code>&#123;{ ... }}</code> Jinja variable delimiters.
<syntaxhighlight lang='yaml'>
- name: Debug
  debug:
  var: java_module_files
</syntaxhighlight>

Latest revision as of 09:33, 4 July 2021

External

Internal

Overview

Can be used to issue debug messages, in which variables can be embedded as {{ variable_name }}.

Module Arguments

msg

A string to display. Can include variable names introduced with {{ ... }}. If the only thing to display is a variable, it must be quoted: "{{ var_name }}". If this is the case, consider using var.

- name: Debug
  debug:
    msg: Some message that refers to the content of {{ some_var.some_key }}

var

A variable name to debug. Mutually exclusive with the msg option. Must not use {{ ... }} Jinja variable delimiters.

- name: Debug
  debug:
   var: java_module_files