nerdexam
Red_Hat

EX294 · Question #8

08. Using Roles from Ansible Galaxy Create a playbook named /home/greg/ansible/roles.yml according to the following requirements: - The playbook should include a play that runs on hosts in the…

This playbook integrates pre-installed balancer and phpinfo roles to configure load balancing and web server functionalities on respective host groups.

Submitted by katya_ua· Apr 18, 2026Work with Roles

Question

  1. Using Roles from Ansible Galaxy Create a playbook named /home/greg/ansible/roles.yml according to the following requirements: - The playbook should include a play that runs on hosts in the balancers host group and uses the balancer role. This role configures a service to balance web output: Welcome to node3.lab.example.com on 172.25.250.11 Reloading the browser should generate output from another web server: Welcome to node4.lab.example.com on 172.25.250.12 The playbook should include a play that runs on hosts in the webservers host group and uses the phpinfo role. Accessing hosts in the webservers group via the URL /hello.php should generate the following output: Hello PHP World from FQDN Where FQDN is the fully qualified domain name of the host. Additionally, various detailed information about PHP configuration, such as installed PHP version, should be displayed. Explanation Explanation/Reference: Solution: [greg@control ansible]$ vim /home/greg/ansible/roles.yml --- - name: Use role phpinfo hosts: webservers roles: - phpinfo - name: Use role balancer hosts: balancers roles: - balancer [greg@control ansible]$ ansible-navigator run roles.yml -m stdout

Explanation

This playbook integrates pre-installed balancer and phpinfo roles to configure load balancing and web server functionalities on respective host groups.

Concept tested. Playbook role inclusion and execution

Reference. https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html

Topics

#Ansible Playbook#Ansible Roles#Playbook Structure#Host Groups

Community Discussion

No community discussion yet for this question.

Full EX294 Practice