Hi all,
I'm now doing the 1st Exercise of the "Comprehensive review" ("Lab: Deploying Ansible") of the RH294 course - https://rol.redhat.com/rol/app/courses/rh294-9.0/pages/ch10s02
So, I started the exercise by typing the lab start review-cr1 command and I did the activities. However, when I run the grading script at the end of the exercise by typing the command lab grade review-cr1 , I get a PASS in all the steps except in the "Ensuring redis package is installed on serverb" step where I get a FAIL. The reason why that step is failing seems clear to me: we're told to add a condition in the YAML file - packages.yml - to only install the package if the used Swap is 10 MB or greater, but that condition never gets "triggered". If I SSH to both "servera" and "serverb", it's clear the used Swap is 0 (zero) in both servers, so it's natural that 10 MB or greater used swap conditiion is never satisfied.
Am I right or am I missing something?
Here's the output of my lab grade review-cr1 :
[student@workstation review-cr1]$ lab grade review-cr1 Grading lab. · Checking lab systems .............................................................................. SUCCESS · Ensuring ansible-navigator package is installed on workstation .................................... PASS · Ensuring inventory file is present ................................................................ PASS · Ensuring ansible.cfg file is present .............................................................. PASS · Ensuring ansible-navigator.yml file is present .................................................... PASS · Ensuring the ee-supported-rhel8 image is present .................................................. PASS · Ensuring users.yml playbook is present ............................................................ PASS · Verify joe and sam users are available on servera ................................................. PASS · Verify joe and sam users are available on serverb ................................................. PASS · Ensuring httpd package is installed on servera .................................................... PASS · Ensuring httpd package is installed on serverb .................................................... PASS · Ensuring mariadb-server package is installed on servera ........................................... PASS · Ensuring mariadb-server package is installed on serverb ........................................... PASS · Ensuring redis package is installed on serverb .................................................... FAIL - Playbook failed: verify-package.yml - serverb: Check to see if redis.x86_64 is installed: non-zero return code - serverb: Fail if redis.x86_64 is not installed: The redis.x86_64 package is NOT installed · Ensuring successful verify_user.yml run on servera ................................................ PASS · Ensuring successful verify_user.yml run on serverb ................................................ PASS Overall lab grade: FAIL
And here's the output of the execution of the packages.yml playbook and the content of that YAML file, before I ran the grading script:
[student@workstation review-cr1]$ anr packages.yml PLAY [Install packages] ******************************************************** TASK [Gathering Facts] ********************************************************* ok: [servera.lab.example.com] ok: [serverb.lab.example.com] TASK [Install the required packages] ******************************************* ok: [serverb.lab.example.com] ok: [servera.lab.example.com] TASK [Install the redis package] *********************************************** skipping: [servera.lab.example.com] skipping: [serverb.lab.example.com] PLAY RECAP ********************************************************************* servera.lab.example.com : ok=2 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0 serverb.lab.example.com : ok=2 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
[student@workstation review-cr1]$ cat packages.yml --- - name: Install packages hosts: dev vars: packages: - httpd - mariadb-server tasks: - name: Install the required packages ansible.builtin.dnf: name: "{{ packages }}" state: latest - name: Install the redis package when: ansible_facts['swaptotal_mb'] > 10 ansible.builtin.dnf: name: redis state: latest
Thank you very much for the answers you've given me, @Travis and @Chetan_Tiwary_
I confirm that I had ran initially the lab start review-cr1 command and that it had completed successfully.
As you can see in the following outputs, there was no swap in "servera" or in "serverb":
[student@workstation ~]$ ssh student@servera cat /proc/swaps Filename Type Size Used Priority [student@workstation ~]$ ssh student@serverb cat /proc/swaps Filename Type Size Used Priority
Having said that, I now have some Good News: I managed to solve this problem by first doing the backup copy of the directory with my solution (following @Travis great suggestion!), then running the lab finish review-cr1 command and running again lab start review-cr1. After I did that, the 100 MB Swap appeared on "serverb":
[student@workstation ~]$ lab finish review-cr1 Finishing lab. · Checking lab systems .............................................................................. SUCCESS · Clean up exercise ................................................................................. SUCCESS [student@workstation ~]$ lab start review-cr1 Starting lab. · Checking lab systems .............................................................................. SUCCESS · Adding exercise content ........................................................................... SUCCESS · Ensuring required packages are installed .......................................................... SUCCESS · Setting up exercise ............................................................................... SUCCESS [student@workstation ~]$ ssh student@servera "cat /proc/swaps" Filename Type Size Used Priority [student@workstation ~]$ ssh student@serverb "cat /proc/swaps" Filename Type Size Used Priority /100MB.swap file 102396 0 -2
After I've done that, I restored my resolution from my backup directory, then installed again the "ansible-navigator" package (and dependencies), ran again the "podman utility.lab.example.com" command to log in, then ran again the "users.yml" and "packages.yml" playbooks (which this time installed the "redis" package in "serverb", because the Swap condition was now fulfilled). Finally, I ran again the lab grade review-cr1 ...and this time I got a PASS in every step!
Again, thank you very much for the help you've given me, @Travis and @Chetan_Tiwary_ !
@ric -
So it is possible you either have older lab scripts or the "start" command didn't work successfully. One of the things the "start" command does is creates a 100MB SWAP partition on ServerB. Based on what you've shown above that didn't happen.
Can you confirm that you ran the "start" script and it completed successfully?
Before you re-run the start scripts, copy the directory that you playbooks and items are in to another directory. That way the start/finish/cleanup process doesn't delete your work and you can re-run the lab. ServerB should definitely have SWAP and this should have been created as part of the "Start" command.
dd if=/dev/zero of=/100MB.swap bs=1024 count=102400
mkswap /100MB.swap
swapon /100MB.swap
The other thing that might have happened is if you turned off fact gathering and it couldn't find there was SWAP on serverB, but I assumed you already checked manually that there was no swap.
@ric I could not reproduce the error from my side : could you please recheck preferrably in a freshly created lab env.
I can see the 100M swap on serverb :
Thank you very much for the answers you've given me, @Travis and @Chetan_Tiwary_
I confirm that I had ran initially the lab start review-cr1 command and that it had completed successfully.
As you can see in the following outputs, there was no swap in "servera" or in "serverb":
[student@workstation ~]$ ssh student@servera cat /proc/swaps Filename Type Size Used Priority [student@workstation ~]$ ssh student@serverb cat /proc/swaps Filename Type Size Used Priority
Having said that, I now have some Good News: I managed to solve this problem by first doing the backup copy of the directory with my solution (following @Travis great suggestion!), then running the lab finish review-cr1 command and running again lab start review-cr1. After I did that, the 100 MB Swap appeared on "serverb":
[student@workstation ~]$ lab finish review-cr1 Finishing lab. · Checking lab systems .............................................................................. SUCCESS · Clean up exercise ................................................................................. SUCCESS [student@workstation ~]$ lab start review-cr1 Starting lab. · Checking lab systems .............................................................................. SUCCESS · Adding exercise content ........................................................................... SUCCESS · Ensuring required packages are installed .......................................................... SUCCESS · Setting up exercise ............................................................................... SUCCESS [student@workstation ~]$ ssh student@servera "cat /proc/swaps" Filename Type Size Used Priority [student@workstation ~]$ ssh student@serverb "cat /proc/swaps" Filename Type Size Used Priority /100MB.swap file 102396 0 -2
After I've done that, I restored my resolution from my backup directory, then installed again the "ansible-navigator" package (and dependencies), ran again the "podman utility.lab.example.com" command to log in, then ran again the "users.yml" and "packages.yml" playbooks (which this time installed the "redis" package in "serverb", because the Swap condition was now fulfilled). Finally, I ran again the lab grade review-cr1 ...and this time I got a PASS in every step!
Again, thank you very much for the help you've given me, @Travis and @Chetan_Tiwary_ !
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.