Ansible - Register variable in not defined

I am trying to figure out why my variable is not defined and have not been able to find any solutions online.
Can anyone help?

test.yml

Try this it worked for me, A play takes a list of tasks so each tasks should start with dash -:

Thanks Syed. I added a validation step and that is failing.

Updated playbook

“test_out”: {
“changed”: false,
“failed”: false,
“msg”: “hello”
}

there is no key named test here. You need to use ‘test_out.msg’ above.

Yes that worked, but for the client I am working with, I am unable to change the validation. How would I define it so that test_out.test would work?

You can't since debug doesn't return test.