Create a file called adhoc.sh in /home/sandy/ansible which will use adhoc commands to set up a new repository. The name of the repo will be 'EPEL' the description 'RHEL8' the baseurl is 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rmp' there is no gpgcheck, but you should enable the repo.
* You should be able to use an bash script using adhoc commands to enable repos. Depending on your lab setup, you may need to make this repo "state=absent" after you pass this task.
Suggested Answer: A
Get Premium EX294 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
35 comments · newest first
JO
Jose
11 months ago
I’m surprised this works without any additional dependencies.
LA
Layla
12 months ago
Looks good to me, I've used similar commands before!
AN
An
12 months ago
Wait, is it really necessary to set gpgcheck to no? Seems risky.
EL
Ellen
1 year ago
Totally agree, that could cause issues when running the script.
MI
Mirta
1 year ago
Just a heads up, the baseurl link has a typo, it should be .rpm not .rmp.
MO
Mozell
1 year ago
I remember needing to set `state=absent` in a previous exercise, but I can't remember if that was for enabling or disabling a repo.
JE
Jesusa
1 year ago
I feel like I need to double-check the path for the bash shebang line; I think it should be `#!/bin/bash`, but I might be mixing it up with something else.
ED
Edgar
1 year ago
I practiced a similar question where we had to enable a repo, but I can't recall if I used `enabled=yes` or `enabled=true`.
AL
Alisha
1 year ago
I think I remember using the `yum_repository` module for setting up repos, but I'm not entirely sure about the syntax for the baseurl.
TR
Tracie
1 year ago
Alright, I've got this. I'll create the script, use the `yum_repository` module to set up the EPEL repo, and then check if I need to remove it afterwards. Feels like a good opportunity to practice my Ansible skills.
CA
Caprice
1 year ago
This looks straightforward enough. I'll make sure to use the correct Ansible module and parameters to enable the EPEL repo as specified. Shouldn't be too difficult as long as I follow the instructions carefully.
EM
Emiko
1 year ago
I'm a bit confused about the "state=absent" part at the end. Does that mean I need to remove the repo after setting it up? I'll have to double-check the instructions on that.
KE
Kenny
1 year ago
Okay, let me think this through step-by-step. First, I'll create the `adhoc.sh` file in the `/home/sandy/ansible` directory. Then, I'll use the `ansible` command to run the `yum_repository` module with the specified parameters.
TI
Tiera
1 year ago
Hmm, this looks like a straightforward task. I'll need to create a bash script and use Ansible's `yum_repository` module to set up the EPEL repo.
LA
Lauran
2 years ago
Wait, did someone say 'chmod 0777'? That's a bit overkill, don't you think? Let's keep the permissions a bit more secure, shall we?
YV
Yvette
1 year ago
User1: Agreed, let's update the permissions to 0755 for better security.
KI
Kirk
1 year ago
User2: Good point, 0755 is a better choice for file permissions.
BE
Bernadine
1 year ago
User1: You're right, 0777 is too permissive. Let's use more secure permissions like 0755.
CA
Callie
2 years ago
This is a great question! I'm surprised they didn't ask us to use the 'yum_repository' module instead of the 'ansible' command directly.
AS
Ashlyn
2 years ago
Haha, the script is almost perfect, but I think we need to add a 'reponame=EPEL' parameter to match the name specified in the question.
MO
Monte
1 year ago
Great suggestion! I'll add 'reponame=EPEL' to the adhoc.sh script for accuracy.
GE
Gearldine
1 year ago
Adding 'reponame=EPEL' will ensure the repo name matches the specified name. I'll update the script.
SK
Skye
1 year ago
Thanks for pointing that out. I'll make sure to include 'reponame=EPEL' in the script.
JO
Joni
2 years ago
Good catch! Let's add 'reponame=EPEL' to the adhoc.sh script.
JA
Jame
2 years ago
The script looks good, but I would suggest adding a 'become: yes' parameter to the ansible command to ensure the task is executed with elevated privileges.
GA
Gary
1 year ago
Good idea, I'll include 'become: yes' to ensure elevated privileges for the task.
DE
Devora
1 year ago
Thanks for the suggestion! I'll make sure to add 'become: yes' to the ansible command.
EL
Elden
2 years ago
This seems like a straightforward task. The provided script looks good, though I might add a 'state=present' parameter to ensure the repository is enabled.
SH
Sharita
1 year ago
User 4: Good point, that would make sure everything is set up correctly.
LE
Lenna
1 year ago
User 3: I might add a 'state=present' parameter to ensure the repository is enabled.
AL
Aleisha
2 years ago
User 2: Yeah, the provided script looks good.
BU
Burma
2 years ago
User 1: This seems like a straightforward task.
TA
Tanesha
2 years ago
Yes, the bash script example given for enabling the repo makes it easier to understand the steps involved.
DE
Delsie
2 years ago
I agree, but the explanation provided for creating the repo using adhoc commands seems clear and helpful.
TA
Tanesha
2 years ago
I think creating the adhoc.sh file in /home/sandy/ansible to set up a new repository sounds challenging.