I've been struggling for nearly 2 hours trying to figure out where my mistake is in this lab. After creating the playbook and running the play, I keep receiving the message "auth_test.content": VARIABLE IS NOT DEFINED! on the debug task. I took a screenshot; it is the last task performed.
Here is a screenshot of the entire playbook, I can't seem to find my error, though I think it has something to do 'Create index.html' task but I'm not sure what to do to fix it. Any help or suggestions would be greatly appreciated!
Hi @TiffanyA,
Why don't you try print auth_test? If content doesn't exist there, it should at least contain some other information, since it's a dictionary anyway.
Another thing to try, and this is really a long shot, would be printing auth_test['content'] insteand of auth_test.content. This could only work if the previous step was successful.
And if none of these ideas work, try to curl the webserver from the shell and see what it returns (old methods always work).
Let me know how it goes :-)
@Vicente , thank you so much for the response. I went back to the lab to try your suggested solutions, when I actually figured out my error....the 'register' module should be aligned with 'uri' module. Well, I feel a bit sheepish now. I guess I just needed to step away and try again with a fresh set of eyes. I appreciate your suggestions and sorry to waste your time!
@TiffanyA, I didn't spot that either, well done.
Any reason why using so much padding? It's going to be a mess when you have to work in a team.
And you didn't waste my time at all, I enjoy those "challenges" too :-)
This is actually a lab for RH294 course being taught at my school. I was just following the student workbook (well, the online book) that came with it. I'm a lab tech so this summer, I've been proofing labs to make sure there aren't any hiccups or instructional errors. What do you mean by padding?....I'm curious!
Ansible is not the only language that uses YAML. As an example, I quote from the SaltStack website: "The suggested syntax for YAML files is to use 2 spaces for indentation, but YAML will follow whatever indentation system that the individual file uses. Indentation of two spaces works very well for SLS files given the fact that the data is uniform and not deeply nested."
Basically what I meant is that code doesn't need to be only functional, it can also be pretty ;-)
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.