cancel
Showing results for 
Search instead for 
Did you mean: 
  • 1,039 Views

RH294 Chapter 4 Lab: Managing Variables and Facts

Hi RH team

I failed pass lab (check web server)  in RH294 Chapter 4 Lab: Managing Variables and Facts cause I forgot put \n in ansible task bellow.

- name: create index.html
copy:
content: "{{ ansible_facts['fqdn'] }} ({{ ansible_facts['default_ipv4']['address'] }}) has been customized by Ansible.\n"
dest: "{{ web_root }}/index.html"
I think it's not critial mistake, but script 'lab data-review grade' do not think so :)

Thank you

Labels (1)
2 Replies
RangerKnight
Mission Specialist
Mission Specialist
  • 969 Views

I had a similar problem.  I could not figure out what was wrong. My playbook was working and I was getting the results.  It turns out that I had an extra space between the ip address and the closing parenthesis.  Seems a bit of a minor issue to give a fail and wasted lots of my time trying to find a functional issue that didn't exist.

0 Kudos
Tracy_Baker
Starfighter Starfighter
Starfighter
  • 960 Views

@VladimirGr 

Keep in mind that many times the grading script is looking for something very specific -- even though what you did achieved the task's goal.

In a previous class (either RH124 or RH134) a student is asked to put some text into a file, something to the effect of: Hello World!

We found that if Hello World were put into the file (missing the exclamation point), the grading script would fail -- even though the task that was being tested (say: redirecting text into a file from the command line) was done correctly.

As a matter of fact, if you miss the period between Ansible and \n, (or, as @RangerKnight said, put in an extra space) the grading script will fail.

The text that must appear in the index.html file must read, exactly:

serverb.lab.example.com (172.25.250.11) has been customized by Ansible.

If it does not, the grading script will fail. Interestingly, the instructions want you to create the text using Ansible facts for the FQDN and IP address. In reality, you can simply put that line of text into the index.html, like:

content: "serverb.lab.example.com (172.25.250.11) has been customized by Ansible.\n"

The grading script will pass. This tells me that the script isn't grading your playbook; rather, it is grading the response it receives from the systems in the webservers group.

Of course, if you do this, you aren't practicing using your Ansible facts.

 

Program Lead at Arizona's first Red Hat Academy, est. 2005
Estrella Mountain Community College
Join the discussion
You must log in to join this conversation.