Search code examples
ansible

Is it possible to debug multiple variables in one Ansible task without using a loop?


I want to print var1 and var2 in one Ansible task. I have this working YAML.

- debug:
    var: "{{ item }}"
  with_items:
    - var1
    - var2

I wonder whether is possible to do it without using with_items nor msg parameter.


Solution

  • I find this to be very handy:

    - name: Display variables
      ansible.builtin.debug:
        msg:
          - "x: {{ x }}"
          - "y: {{ y }}"