cancel
Showing results for 
Search instead for 
Did you mean: 
TravellingKiwi
Mission Specialist
Mission Specialist
  • 110 Views

CH6 grading

Jump to solution

I'm starting to think thge CH6 gradiung script has something against me. I can't work out why it thinks several of the checks fail. 

TravellingKiwi_0-1743106805589.png

Taking a few of them in order. The site.yml 'failure' When i execute the site.yml playbook, it works fine. e.g.

TravellingKiwi_1-1743106904611.png

The 'missing' or faulty copy task... My original did the right thing. But used 

TravellingKiwi_2-1743107056358.png


so thinking the grading script was being a bit pedantic, I went back and copied (Via copy & paste) the solution. It still claims a fail. 

Maybe it was checking the commit message... So I updated somethign else and used a commit message 'Lab updates'. Still a fail.

I'm almost at a loss. Burning through the hours without being able to work out what the grading script wants, when it apparently doesn't even want the canned solutions.

It also doesn't like my refactoring for the httpd package installs...

TravellingKiwi_3-1743107236199.png

But then it also doesn't like a copy of the canned solution...


I'm clearly missing something obvious. 

0 Kudos
1 Solution

Accepted Solutions
TravellingKiwi
Mission Specialist
Mission Specialist
  • 66 Views

Ahhh...

There seems to be two assumptions

1. The lab will be completed in 1 session perhaps? 
2. You won't make any typos and your resulting playbook will run through completely without errors on the first execution.

IIRC I did the lab start. Did some edits. Then (As usual in my day) I had to go do some real work. Everything got shutdown. Somewhere (Possibly) after an initial run of site.yml that struck an error in a builtin config... My favourite at the moment appears to be using path: in ansible.builtin.copy instead of dest:

If that error is in the handler, then the first time you run it, the haproxy config is done. And the playbook errors on the handler. 


However... The second (And subsequent) times you run it. The haproxy config is not changed. Thus the handlers don't get called. And because the servers were rebooted, there's no files in /tmp that the handlers would have left the first time around. And the playbook succeeds

You can duplicate this easily. Just make an error in the handler (e.g. the above. replace dest: with path: in the copy). It'll fail. Fix it, and run again, and the handlers don't execute. Because the config didn't change.

This explains why site.yml fails in the grading but continually succeeds at the command line. When the grading runs, it removes the haproxy packages & config.
It then does some stuff, and runs the playbook, which fails (Error in the handler). You then run it yourself because of course it ran fine last time you ran it, and it runs fine again. You can do that ad-nauseaum because only the grading removes the haproxy packages & config from servera.

I'm at a loss however why the grading told me the refactoring of the apache package installs hadn't been done. Because after fixing the handler, the grading for the refactoring now gets a PASS.

So, the solution was obvious and easy. But only if you know the mechanism of how the gradings and the labs work and spend some time running through it in your head and watching the grading process... e.g.

TravellingKiwi_0-1743111970785.png

 




It would be nice to have an easy way to reset the environments so each time you run your playbooks it's starting from a known point.


View solution in original post

6 Replies
khyuma04
Cadet
Cadet
  • 103 Views

If i recall correctly you need the  newline character \n in the copy task, otherwise the script fails

0 Kudos
TravellingKiwi
Mission Specialist
Mission Specialist
  • 100 Views

I did that... Still failed. Then I actually went an copied the soltuion one in the end. Thinking maybe I had a random unprintable and not just a space on the end of the filename...

 

Still failed. It doesn't like the canned solution either.

It's like it's not even checking my directory... but one somewhere else.

 

 

0 Kudos
rhnoname
Flight Engineer Flight Engineer
Flight Engineer
  • 97 Views

Regarding the copy task I always did it on the same line:

content: "Playbook site.yml ready to start".

The other task seem written correctly. Try do the exercise from scratch or - even better - delete all the lab env and re-create it from the beginning. This usually helps

Best Regards
0 Kudos
TravellingKiwi
Mission Specialist
Mission Specialist
  • 91 Views

Start from scratch will probably become a thing... But it won't help me understand why it's failing. Which is important (To me anyway)

0 Kudos
TravellingKiwi
Mission Specialist
Mission Specialist
  • 69 Views

I think I have found 1 issue. The triggers from the haproxy don't get called.

 

They don't get called, because there is no change to the haproxy config file. Because the config file appears to already be there when the lab starts? Maybe. But there doesn't appear to be any process involved that will reset the haproxy config file on servera...

 

That seems to agree with the state of the servers when I started the task-review. Apache was already installed the first time I ran site.yml. I had to run the cleanup before the original (looped) dnf install for apache packages was executed.

 

Wonder what will happen if I do trash the lab and start again from scratch.

 

0 Kudos
TravellingKiwi
Mission Specialist
Mission Specialist
  • 67 Views

Ahhh...

There seems to be two assumptions

1. The lab will be completed in 1 session perhaps? 
2. You won't make any typos and your resulting playbook will run through completely without errors on the first execution.

IIRC I did the lab start. Did some edits. Then (As usual in my day) I had to go do some real work. Everything got shutdown. Somewhere (Possibly) after an initial run of site.yml that struck an error in a builtin config... My favourite at the moment appears to be using path: in ansible.builtin.copy instead of dest:

If that error is in the handler, then the first time you run it, the haproxy config is done. And the playbook errors on the handler. 


However... The second (And subsequent) times you run it. The haproxy config is not changed. Thus the handlers don't get called. And because the servers were rebooted, there's no files in /tmp that the handlers would have left the first time around. And the playbook succeeds

You can duplicate this easily. Just make an error in the handler (e.g. the above. replace dest: with path: in the copy). It'll fail. Fix it, and run again, and the handlers don't execute. Because the config didn't change.

This explains why site.yml fails in the grading but continually succeeds at the command line. When the grading runs, it removes the haproxy packages & config.
It then does some stuff, and runs the playbook, which fails (Error in the handler). You then run it yourself because of course it ran fine last time you ran it, and it runs fine again. You can do that ad-nauseaum because only the grading removes the haproxy packages & config from servera.

I'm at a loss however why the grading told me the refactoring of the apache package installs hadn't been done. Because after fixing the handler, the grading for the refactoring now gets a PASS.

So, the solution was obvious and easy. But only if you know the mechanism of how the gradings and the labs work and spend some time running through it in your head and watching the grading process... e.g.

TravellingKiwi_0-1743111970785.png

 




It would be nice to have an easy way to reset the environments so each time you run your playbooks it's starting from a known point.


Join the discussion
You must log in to join this conversation.