--- - hosts: localhost gather_facts: False vars: phrases: - 'Hello World' - 'Óla Mundo' tasks: - name: debug plugin using with_ command: 'echo {{ item }}' with_debug: - 'Hello World' - 'Óla Mundo' register: results - debug: var: results - name: Just want to look at the structure of results.... fail: - name: debug plugin using with_ and a list in variable command: 'echo {{ item }}' with_debug: '{{ phrases }}' - name: Using loop command: 'echo {{ item }}' loop: - 'Hello World' - 'Óla Mundo' - name: Using loop and a list in variable command: 'echo {{ item }}' loop: '{{ phrases }}' - name: debug plugin using loop command: 'echo {{ item }}' loop: '{{ q("debug", "Hello World", "Óla Mundo") }}' - name: debug plugin using loop and list in a variable command: 'echo {{ item }}' loop: '{{ q("debug", *phrases) }}' - name: debug plugin using loop with prefix and suffix command: 'echo {{ item }}' loop: '{{ q("debug", prefix="Computer: [", suffix="]", *phrases) }}' - name: debug plugin using loop with lookup, prefix, and suffix command: 'echo {{ item }}' loop: '{{ lookup("debug", prefix="Computer: [", suffix="]", wantlist=True, *phrases) }}' # Note: The following order of arguments doesn't work due to this jinja2 bug/missing feature: # https://github.com/pallets/jinja/pull/802 #- name: debug plugin using loop with prefix and suffix # command: 'echo {{ item }}' # loop: '{{ q("debug", *phrases, prefix="Computer: [", suffix="]") }}'