register won't read

Hi! I'm new to Ansible. I'm trying to run these plays but I get an error
that says
AILED! => {"msg": "The task includes an option with an undefined variable.
The error was: 'dict object' has no attribute 'stderr'\n\nThe error appears
to have been in '/home/ansible/playbooks/testfile.yml': line 14, column 7,
but may\nbe elsewhere in the file depending on the exact syntax
problem.\n\nThe offending line appears to be:\n\n msg: \"STDOUT - {{
ansible_os_family }}\"\n - debug:\n ^ here\n\nexception type: <class
'ansible.errors.AnsibleUndefinedVariable'>\nexception: 'dict object' has no
attribute 'stderr'"}

---- hosts: db tasks: - name: copy file to server copy: src=test.sh
dest=/home/ansible/test.sh mode=0755 - name: Run the script command:
/home/ansible/test.sh register: out ignore_errors: yes - debug: msg:
"STDOUT - {{ ansible_os_family }}" - debug: msg: "{{ out.stderr }}"
Please Help!!

HI Pranay!

You’re trying to display stderr which is “standard error output” - if your script is not returning it - this variable is empty / does not exist.

First of all please check what is displayed by raw {{ out }} and probably what you’re looking for is {{ out.stdout }}.

Best,
Karol