This week kicked my ass a bit. I took a timed RHCE practice exam and failed miserably. After 4 hours, I was only on task 6 out of 18. After pushing for another 3 hours, then for the rest of the week..
I started to lose hope.
Sign up free to receive updates on this series!
After giving up twice, rebuilding the lab, smashing my head against a wall, cry-cuddling my dog, then staring blankly at the screen rethinking my life decisions. I decided to keep pressing forward.
What has tripped me up so far?
Follow directions..
First off, I did not set up the lab right. I used RHEL version 10 instead of version 8 (Wow David). This did not give me any problems until I got to custom repository tasks that required RHEL 8.
As a side note, my actual exam is for RHEL 9. So I’ll need to find a specific exam for the correct version or modify some tasks to fit with RHEL 9.
I ended up rebuilding my lab on RHEL 8 to match the practice exam. Which only took about 5 minutes. And now I begin anew with a keen eye for details.
Here is the adhoc script I came up with for task 2.
#!/bin/bash
ansible ansible2 --become-user root -m user -K --ask-become-pass --become -a "name=automation state=present groups=wheel"ansible ansible3 --become-user root -m user -K --ask-become-pass --become -a "name=automation state=present groups=wheel"ansible ansible4 --become-user root -m user -K --ask-become-pass --become -a "name=automation state=present groups=wheel"ansible ansible5 --become-user root -m user -K --ask-become-pass --become -a "name=automation state=present groups=wheel"ansible all:!localhost -m file -K --ask-become-pass --become --become-user root -a "path=/home/automation/.ssh state=directory mode='0755'"ansible all:!localhost -m file -K --ask-become-pass --become --become-user root -a "path=/home/automation/.ssh state=directory mode='0755'"ansible all:!localhost -m lineinfile -K --ask-become-pass --become --become-user root -a "path=/home/automation/.ssh/authorized_keys state=present create=true line='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCucgpRJSz8pNX3MgjAdRLJA3FHmrNconvssiO0sgtC6nvgO4PTcVQYdBTHeATPJkXRTHdn8GKZnDx7fRrI4WqbqztmtYRPk24QZJ2AZUgoBHsYwge+aNFFKfcEdY2D9dIQQQZl8GpmTnlcSzkbB0bAwaG0ezmmSr63V0nPh62ITQ/ipIy7IMJNuKc9pzus/FhTVI6J6RVbe7u6go4PTsyIAYQGqtvmV0c7g4s6tYuriBwQkeQYj38BopxAak9jCrs2rUm5wIwsA4sIpI3zj4/eHXGH19tklVZsuJgpXbV8F+eJVHCwj9sTCMYFasElTfNB6cwcgjV+DbOMLhaa9kDUa8p8xoXshDzK6P0ACd5UD9ZNYbfaD9M0xcHC8YtmPmaHwMrfnbw6ki91Z3AMGSolY4lY8SP7wkgBpwOKZqwOfDBdGCFYd002zeKwpFeSxWUPNpnXfYZ4fGufWAxpMX0i8h0ia91kVIlkzhdEB3sZkG1L80roBFRSKvm8TOGswX0='"ansible all:!localhost -m lineinfile -K --ask-become-pass --become --become-user root -a "path=/etc/sudoers state=present regexp='^%wheel' line='%wheel ALL=(ALL) NOPASSWD: ALL'"
Task 3: File content
This task was pretty straightforward.
---- name:motd message for Proxy Serversbecome:yeshosts:proxytasks:- name:Add text to motd proxy serverslineinfile:path:/etc/motdline:"Welcome to HAProxy server"- name:motd message for web Serversbecome:yeshosts:webserverstasks:- name:Add text to motd webserverlineinfile:path:/etc/motdline:"Welcome to Apache server"- name:motd message for database Serversbecome:yeshosts:databasetasks:- name:Add text to motd database serverslineinfile:path:/etc/motdline:"Welcome to MySQL server"
Task 4: Configure sshd
Another easy one. Just open up the sshd_config file on the target host to see what to regex.
I added the user password as plain text at first. Then remembered later this needed to be stored as an MD5 hash. Luckily, the ansible-doc user document had a link to directions for generating the hashed password.
Task 6: Users and groups
This is when I first had to leave official documentation for help. The answer actually existed in the documentation but I didn’t know what I was searching for. In this task, you need a way to match user id’s based on the number that the id begins with.
I spent a full hour on this task before I ran for help..
The regex_search function is how I solved the problem:
Another easy one! The cron module documentation is great here.
[automation@ansible-control plays]$ cat regular_tasks.yml ---- name:cron for proxy servershosts:proxybecome:yestasks:- name:append date to logcron:name:"time"minute:0job:"date >> /var/log/time.log"user:root
Task 8: Software repositories
This task is dated and later tasks will fail because of it. This shouldn’t be a problem during the actual exam. Just follow examples in ansible-doc yum_repository.
This is where using an old practice exam really started to really trip me up. I find roles easy to work with and was flying though this one. But then I got one-error-after-another.
Had to change the Python interpreter version on the target host to get this to work.
Also, the repository information for mysql community is outdated. So I disabled the custom repository and just installed mysql-server.
And this is where I ran out of time for the week..
What now?
After a full week of working on this practice exam, I only got halfway done. This is painful because I thought I was closer to being ready.
I’ll have to get 7X faster in order to pass. Luckily, I have 33 more study days to do this.
Next week, I will do the second half of the practice exam and continue through reviews and labs.
P.S. If you are studying for RHCE or RHCSA, join our Linux study group on Discord.