The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'stdout
6,990
In YAML the indentation is significant. There are errors if you don't pay attention to the spaces (and tabs) at the beginning of the line.
With your exact spacing the only result is:
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
If you properly indent command
and register
, the snippet works correctly.
Related videos on Youtube
Author by
user2905259
Updated on September 18, 2022Comments
-
user2905259 over 1 year
I am getting issues on my below task.
- name: Deploy incremental changes using rsync command: "sh run" register: data
I am trying to print data down below but keeps getting the above issues, this is a snippet of my code which sends an email after the successful completion of job
-------------------- Components Deployed -------------------- {{ data.stdout }} --------------------- Please verify
-
TheDESTROS almost 5 years"over here" - where is it? supplement your question with the operation with which you are trying to get stdout
-
-
TheDESTROS almost 5 yearsI think he just crookedly copied, because then he would really get a syntax error, and not the one in question
-
Naveed Abbas almost 5 years@TheDESTROS Yes, but I can only answer the questions that were asked, not these that weren't.
-
user2905259 almost 5 years@kubanczyk sorry about the way i copied it, its not the issues with indentation. I am getting an issues with task includes an option with an undefined variable. its complaining about dict object which i haven't passed anywhere.
-
TheDESTROS almost 5 years@user2905259 Do you execute the output command on the same server where do you perform the "Deploy incremental changes using rsync"?
-
user2905259 almost 5 years@TheDESTROS not all the time, we have 15 cluster so task could happen on any server. Is there a other way for me to print those values without using stdout, i am newbie and i just found about that it has to run on the same server to get the output.