Hey @Tom, you can use the lookup plugin to print environment variables. To print multiple env variables, just modify your arguments a little, something like this:
- hosts: all
gather_facts: False
tasks:
- name: Multiple environment variables in a single line ansible task
debug:
msg: "{{ lookup('env','USER','HOME','SHELL') }}"
output
------
"msg": "root,/Users/user,/bin/sh"