- name: get user list from centOs
ansible.builtin.shell:
cmd: cat /etc/passwd
when: ansible_distribution == "CentOs"
register: command_output
- debug:
var: command_output.stdout_lines
When I run this playbook it shows like this
TASK [get user list from centOs] ***************************************************************************************************************************************
skipping: []
TASK [debug] ***********************************************************************************************************************************************************
ok: [] => {
"command_output.stdout_lines": "VARIABLE IS NOT DEFINED!"
}