- name: List contents of /etc directory hosts: all become: yes tasks: - name: List contents of /etc directory command: ls -la /etc register: ls_output - name: Print output debug: var: ls_output.stdout_lines