New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

RedHat EX294 Exam - Topic 8 Question 47 Discussion

Actual exam question for RedHat's EX294 exam
Question #: 47
Topic #: 8
[All EX294 Questions]

Create a role called sample-apache in /home/sandy/ansible/roles that enables and starts httpd, enables and starts the firewall and allows the webserver service. Create a template called index.html.j2 which creates and serves a message from /var/www/html/index.html Whenever the content of the file changes, restart the webserver service.

Welcome to [FQDN] on [IP]

Replace the FQDN with the fully qualified domain name and IP with the ip address of the node using ansible facts. Lastly, create a playbook in /home/sandy/ansible/ called apache.yml and use the role to serve the index file on webserver hosts.

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

0/2000 characters
Carmela
3 months ago
This is a great example of using Ansible facts effectively!
upvoted 0 times
...
Willow
3 months ago
Don't forget to check the firewall rules too!
upvoted 0 times
...
Rene
3 months ago
Wait, does it really restart the webserver every time the file changes?
upvoted 0 times
...
Brianne
4 months ago
Totally agree, this is a solid way to manage web servers with Ansible!
upvoted 0 times
...
Naomi
4 months ago
Sounds straightforward, just need to set up the role and template.
upvoted 0 times
...
Toshia
4 months ago
I remember we need to restart the webserver service when the index.html changes, but I’m not clear on how to set that up in the handlers.
upvoted 0 times
...
Emogene
4 months ago
I believe we need to define the tasks in main.yml, but I'm a bit confused about how to handle the template for the index.html file.
upvoted 0 times
...
Buffy
4 months ago
I practiced a similar question where we had to set up a web server, but I can't recall how to use Ansible facts for the FQDN and IP.
upvoted 0 times
...
Selma
5 months ago
I think I remember that we need to create the role structure first, but I'm not entirely sure about the exact file paths.
upvoted 0 times
...
Lavina
5 months ago
Whoa, this is a pretty comprehensive question. I'll need to make sure I don't miss any of the requirements, like replacing the FQDN and IP in the template. And I'll have to remember to add the handler to restart the webserver when the index.html file changes.
upvoted 0 times
...
Ty
5 months ago
Hmm, this seems like a lot of moving parts. I'll need to make sure I have the file paths and task names correct. Maybe I should sketch out the role structure and playbook first before diving in.
upvoted 0 times
...
Deane
5 months ago
This looks like a straightforward Ansible role and playbook question. I'll need to create the role structure, the tasks to enable and start the services, the template for the index.html file, and the playbook to tie it all together.
upvoted 0 times
...
Adaline
5 months ago
Okay, I think I've got a handle on this. I'll create the sample-apache role, add the tasks to manage the services, build the index.html template, and then use that role in the apache.yml playbook. Shouldn't be too bad as long as I pay attention to the details.
upvoted 0 times
...
Coletta
5 months ago
My strategy is to try running the code with an empty array and see what the output is. That should help me figure out the right answer.
upvoted 0 times
...
Avery
10 months ago
This is a solid solution. The only thing I'd add is a comment in the index.html.j2 template to explain the use of the Ansible facts. Keeps it readable for future maintainers.
upvoted 0 times
Artie
9 months ago
Yes, clear comments can make a big difference in understanding the code later on.
upvoted 0 times
...
Ty
9 months ago
I agree, documentation is key for maintaining code in the long run.
upvoted 0 times
...
Sheron
9 months ago
That's a good point, adding a comment for future maintainers is always helpful.
upvoted 0 times
...
...
Stephane
10 months ago
Haha, I wonder if the FQDN and IP address will actually match the node's details. Better double-check that Ansible fact usage!
upvoted 0 times
Shawnda
9 months ago
User 4: Let's make sure everything is configured correctly before running it.
upvoted 0 times
...
Tamala
9 months ago
User 3: The playbook and role setup looks good though.
upvoted 0 times
...
Peggy
10 months ago
User 2: Yeah, we should double-check the Ansible facts.
upvoted 0 times
...
Levi
10 months ago
User 1: I hope the FQDN and IP address match the node's details.
upvoted 0 times
...
...
William
10 months ago
Hold on, does the firewall really need to be enabled and started? Seems like an unnecessary step for a simple web server setup.
upvoted 0 times
...
Trina
10 months ago
I feel confident about it, I have practiced similar tasks before.
upvoted 0 times
...
Brent
10 months ago
Looks good! The role and playbook seem well-structured, and the template for the index.html file looks perfect. Can't wait to see it in action!
upvoted 0 times
Xuan
10 months ago
User 2: I'm excited to see it work too. The template for the index.html file looks great!
upvoted 0 times
...
Shelton
10 months ago
User 1: Thanks! I spent some time making sure everything was set up correctly.
upvoted 0 times
...
...
Destiny
11 months ago
I agree, setting up all those tasks in ansible roles can be tricky.
upvoted 0 times
...
Shanda
11 months ago
I think this question is quite challenging.
upvoted 0 times
...

Save Cancel