RHCE /EX294 Exam Practice Question 1 (Installing & Configuring Ansible)

What Should I know About The RHCE Exam

RHCE EX294 exam practice question 1

Question


On drdev1.tekneed.com, install and configure Ansible as follows:


*Install the necessary packages.


*Create a static inventory file called /home/lisa/ansible/inventory as follows:
– host1.tekneed.com is a member of the development host group
– host2.tekneed.com is a member of the quality_assurance host group
– host3.tekneed.com and host4.tekneed.com are members of the production host group
– host5.tekneed.com is a member of the security host group
– The security group is a member of the hpc_servers host group


*Create a configuration file called ansible.cfg as follows:

– /home/lisa/ansible/inventory/ must be defined as the host inventory file.
– /home/lisa/ansible/roles/ must be the location of the roles in the playbooks

-The escalation user, and the user that will be used to manage the remote hosts must be root.


This question is based on installing, configuring, and creating Ansible static inventory in the RHCE /EX294 course on this website. If you have gone through this course, solving this wouldn’t be a problem.

RHCE/EX294 Course

Installing Ansible In Linux

Creating and Managing Ansible Configuration File

Setup/Build Ansible Static Inventory

Answer

1. Install Ansible

[lisa@drdev1 ~]$ sudo dnf install ansible

Updating Subscription Management repositories.
Red Hat Ansible Engine 2.8 for RHEL 8 x86_64 (RPMs)              
Dependencies resolved.
..............

2. Create the static inventory with the name, /home/lisa/ansible/inventory

[lisa@drdev1 ~]$ mkdir -p /home/lisa/ansible/
[lisa@drdev1 ~]$ vim /home/lisa/ansible/inventory
[development]
host1.tekneed.com

[quality_assurance]
host2.tekneed.com

[production]
host3.tekneed.com
host4.tekneed.com

[security]
host5.tekneed.com

[hpc_servers:children]
security
RHCE 8  ex294 exam practice question 1

3. create the ansible.cfg configuration file, and add the inventory and roles path.

NOTE: you can always use the Ansible global configuration file (/etc/ansible/ansible.cfg) as a reference in case you forget any key-value pair to use in the configuration file.

[lisa@drdev1 ~]$ vim /home/lisa/ansible/ansible.cfg
[defaults]
inventory=/home/lisa/ansible/inventory
roles_path=/home/lisa/ansible/roles
ask_pass=false
remote_user=root

[privilege_escalation]
become=true
become_method=sudo
become_user=root
become_ask_pass=false

4. Verify the inventory configuration

[controller@drdev1 ~]$ cd /home/lisa/ansible/
[lisa@drdev1 ansible]$ ansible --list-hosts all
  hosts (5):
    host1.tekneed.com
    host2.tekneed.com
    host3.tekneed.com
    host4.tekneed.com
    host5.tekneed.com

5. Verify the current Ansible configuration file.

[lisa@drdev1 ansible]$ ansible --version

ansible 2.8.18
  config file = /home/lisa/ansible/ansible.cfg
  configured module search path = ['/home/lisa/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Oct 11 2019, 15:04:54) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]

Solution Summary

dnf install ansible

vim /home/lisa/ansible/inventory

vim /home/lisa/ansible/.ansible.cfg

click on the link below to watch video on RHCE EX294 exam practice question 1

Watch Video On RHCE EX294 Exam Practice Question 1

Watch Video On Ansible Installation In Linux

Your feedback is welcomed. If you love others, you will share with others

4 Comments

Leave a Reply

Your email address will not be published.


*