0% found this document useful (0 votes)
554 views25 pages

RedHat EX294

test

Uploaded by

phyo nyi aung
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
554 views25 pages

RedHat EX294

test

Uploaded by

phyo nyi aung
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

RedHat

EX294

Red Hat Certified


Engineer (RHCE) exam
for Red Hat Enterprise
Linux 8
Version: Demo
Web: www.marks4sure.com
[ Total Questions: 10]
Email: support@marks4sure.com
IMPORTANT NOTICE
Feedback
We have developed quality product and state-of-art service to ensure our customers interest. If you have any
suggestions, please feel free to contact us at feedback@marks4sure.com

Support
If you have any questions about our product, please provide the following items:

exam code
screenshot of the question
login id/email

please contact us at support@marks4sure.com and our technical experts will provide support within 24 hours.

Copyright
The product of each order has its own encryption code, so you should use it independently. Any unauthorized
changes will inflict legal punishment. We reserve the right of final explanation for this statement.
Practice Test RedHat - EX294

Exam Topic Breakdown


Exam Topic Number of Questions
Topic 1 : LAB SETUP 5
Topic 2 : LAB SETUP – 2 5
TOTAL 10

Pass Your Certification With Marks4sure Guarantee 1 of 22


Practice Test RedHat - EX294

Topic 1, LAB SETUP

You will need to set up your lab by creating 5 managed nodes and one control node.

So 6 machines total. Download the free RHEL8 iso from Red Hat Developers website.

***Control node you need to set up***

You need to create some static ips on your managed nodes then on the control node set them up in the
/etc/hosts file as follows:

vim /etc/hosts

10.0.2.21 node1.example.com

10.0.2.22 node2.example.com

10.0.2.23 node3.example.com

10.0.2.24 node4.example.com

10.0.2.25 node5.example.com

yum -y install ansible

useradd ansible

echo password | passwd --stdin ansible

echo "ansible ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/ansible

su - ansible; ssh-keygen

ssh-copy-id node1.example.com

ssh-copy-id node2.example.com

ssh-copy-id node3.example.com

ssh-copy-id node4.example.com

ssh-copy-id node5.example.com

***Each manage node setup***

First, add an extra 2GB virtual harddisk to each control node 1,2,3. Then add an extra hard disk to control
node 4. Do not add an extra hard disk to node 5. When you start up these machines the extra disks should be
automatically located at /dev/sdb (or /dev/vdb depending on your hypervisor).

Pass Your Certification With Marks4sure Guarantee 2 of 22


Practice Test RedHat - EX294

useradd ansible

echo password | passwd --stdin ansible

echo "ansible ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/ansible

Note python3 should be installed by default, however if it is not then on both the control node and managed
nodes you can install it also set the default python3 if you are having trouble with python2 being the default.

yum -y install python3

alternatives --set python /usr/bin/python3

All machines need the repos available. You did this in RHSCA. To set up locally you just need to do the same
for each machine. Attach the rhel8 iso as a disk to virtualbox, kvm or whatever hypervisor you are using (this
will be /dev/sr0). Then inside the machine:

mount /dev/sr0 to /mnt

Then you will have all the files from the iso in /mnt.

mkdir /repo

cp -r /mnt /repo

vim /etc/yum.repos.d/base.repo

Inside this file:

[baseos]

name=baseos

baseurl=file:///repo/BaseOS

gpgcheck=0

Also the appstream

vim /etc/yum.repos.d/appstream.repo

Inside this file:

[appstream]

name=appstream

baseurl=file:///repo/AppStream

gpgcheck=0

Pass Your Certification With Marks4sure Guarantee 3 of 22


Practice Test RedHat - EX294

Question #:1 - (Exam Topic 1)

Create a file in /home/sandy/ansible/ called report.yml. Using this playbook, get a file called report.txt
(make it look exactly as below). Copy this file over to all remote hosts at /root/report.txt. Then edit the lines
in the file to provide the real information of the hosts. If a disk does not exist then write NONE.

See the Explanation for complete Solution below.

Explanation
Solution as:

Pass Your Certification With Marks4sure Guarantee 4 of 22


Practice Test RedHat - EX294

Pass Your Certification With Marks4sure Guarantee 5 of 22


Practice Test RedHat - EX294

Question #:2 - (Exam Topic 1)

Create an empty encrypted file called myvault.yml in /home/sandy/ansible and set the password to
notsafepw. Rekey the password to iwejfj2221.

See the Explanation for complete Solution below.

Explanation

Pass Your Certification With Marks4sure Guarantee 6 of 22


Practice Test RedHat - EX294

ansible-vault create myvault.yml

Create new password: notsafepw Confirm password: notsafepw ansible-vault rekey myvault.yml

Current password: notsafepw New password: iwejfj2221 Confirm password: iwejfj2221

Question #:3 - (Exam Topic 1)

Create the users in the file usersjist.yml file provided. Do this in a playbook called users.yml located at
/home/sandy/ansible. The passwords for these users should be set using the lock.yml file from TASK7. When
running the playbook, the lock.yml file should be unlocked with secret.txt file from TASK 7.

All users with the job of 'developer' should be created on the dev hosts, add them to the group devops, their
password should be set using the pw_dev variable. Likewise create users with the job of 'manager' on the
proxy host and add the users to the group 'managers', their password should be set using the pw_mgr variable.

See the Explanation for complete Solution below.

Explanation
ansible-playbook users.yml –vault-password-file=secret.txt

Pass Your Certification With Marks4sure Guarantee 7 of 22


Practice Test RedHat - EX294

Pass Your Certification With Marks4sure Guarantee 8 of 22


Practice Test RedHat - EX294

Question #:4 - (Exam Topic 1)

Create a file called requirements.yml in /home/sandy/ansible/roles to install two roles. The source for the
first role is geerlingguy.haproxy and geerlingguy.php. Name the first haproxy-role and the second php-role.
The roles should be installed in /home/sandy/ansible/roles.

See the Explanation for complete Solution below.

Explanation
in /home/sandy/ansible/roles

vim requirements.yml

Pass Your Certification With Marks4sure Guarantee 9 of 22


Practice Test RedHat - EX294

Run the requirements file from the roles directory:

ansible-galaxy install -r requirements.yml -p /home/sandy/ansible/roles

Question #:5 - (Exam Topic 1)

Create a jinja template in /home/sandy/ansible/ and name it hosts.j2. Edit this file so it looks like the one
below. The order of the nodes doesn't matter. Then create a playbook in /home/sandy/ansible called
hosts.yml and install the template on dev node at /root/myhosts

See the Explanation for complete Solution below.

Explanation
Solution as:

Pass Your Certification With Marks4sure Guarantee 10 of 22


Practice Test RedHat - EX294

Pass Your Certification With Marks4sure Guarantee 11 of 22


Practice Test RedHat - EX294

Topic 2, LAB SETUP – 2

control.realmX.example.com _ workstation.lab.example.com

node1.realmX.example.com _ servera.lab.example.com

node2.realmX.example.com _ serverb.lab.example.com

node3.realmX.example.com _ serverc.lab.example.com

node4.realmX.example.com _ serverd.lab.example.com

node5.realmX.example.com

- username:root, password:redhat

- username:admin, password:redhat

note1. don’t change ‘root’ or ‘admin’ password.

note2. no need to create ssh-keygen for access, its pre-defined

note3. SELinux is in enforcing mode and firewalld is disabled/stop on whole managed hosts.

Question #:6 - (Exam Topic 2)

Create and run an Ansible ad-hoc command.

--> As a system administrator, you will need to install software on the managed

nodes.

--> Create a shell script called yum-pack.sh that runs an Ansible ad-hoc command to

create yum-repository on each of the managed nodes as follows:

--> repository1

-----------

1. The name of the repository is EX407

2. The description is "Ex407 Description"

3.

The base URL is http://content.example.com/rhel8.0/x86_64/dvd/BaseOS/

Pass Your Certification With Marks4sure Guarantee 12 of 22


Practice Test RedHat - EX294

4. GPG signature checking is enabled

5.

The GPG key URL is http://content.example.com/rhel8.0/x86_64/dvd/RPM-GPG-KEYredhat-

release

6. The repository is enabled

--> repository2

-----------

1. The name of the repository is EXX407

2. The description is "Exx407 Description"

3.

The base URL is http://content.example.com/rhel8.0/x86_64/dvd/AppStream/

4. GPG signature checking is enabled

5.

The GPG key URL is http://content.example.com/rhel8.0/x86_64/dvd/ RPM-GPG-KEYredhat-

release

6. The repository is enabled

See the Explanation for complete Solution below.

Explanation
Solution as:

# pwd

/home/admin/ansible

# vim yum-pack.sh

#!/bin/bash

ansible all -m yum_repository -a 'name=EX407 description="Ex407 Description"

baseurl=http://content.example.com/rhel8.0/x86_64/dvd/BaseOS/

gpgcheck=yes

Pass Your Certification With Marks4sure Guarantee 13 of 22


Practice Test RedHat - EX294

gpgkey=http://content.example.com/rhel8.0/x86_64/dvd/RPM-GPG-KEY-redhat-release

enabled=yes'

ansible all -m yum_repository -a 'name=EXX407 description="Exx407 Description"

baseurl=http://content.example.com/rhel8.0/x86_64/dvd/AppStream/

gpgcheck=yes

gpgkey=http://content.example.com/rhel8.0/x86_64/dvd/RPM-GPG-KEY-redhat-release

enabled=yes'

!wq

# chmod +x yum-pack.sh

# bash yum-pack.sh

# ansible all -m command -a 'yum repolist all'

Question #:7 - (Exam Topic 2)

Install and configure Ansible on the control-node control.realmX.example.com as

follows:

-------------------------------------------------------------------------------------------

--> Install the required packages

--> Create a static inventory file called /home/admin/ansible/inventory as follows:

node1.realmX.example.com is a member of the dev host group

node2.realmX.example.com is a member of the test host group

node3.realmX.example.com & node4.realmX.example.com are members of the prod

host group

node5.realmX.example.com is a member of the balancers host group.

prod group is a member of the webservers host group

--> Create a configuration file called ansible.cfg as follows:

--> The host inventory file /home/admin/ansible/inventory is defined

Pass Your Certification With Marks4sure Guarantee 14 of 22


Practice Test RedHat - EX294

--> The location of roles used in playbooks is defined as /home/admin/ansible/ roles

See the Explanation for complete Solution below.

Explanation
Solution as:

Through physical host, login to workstation.lab.example.com with user root.

# ssh root@workstation.lab.example.com

# hostname

workstation.lab.example.com

# yum install platform-python*

# su - admin

# pwd

/home/admin/

# vim .vimrc

# mkdir -p ansible/roles

# cd ansible

# vim inventory

[dev]

servera.lab.example.com

[test]

serverb.example.com

[prod]

serverc.example.com

serverd.example.com

[balancer]

serverd.lab.example.com

Pass Your Certification With Marks4sure Guarantee 15 of 22


Practice Test RedHat - EX294

[webservers:children]

prod

!wq

# vim ansible.cfg

[defaults]

inventory = ./inventory

role_path = ./roles

remote_user = admin

ask_pass = false

[privilege_escalation]

become = true

become_method = sudo

become_user = root

become_ask_pass = false

!wq

# ansible all -–list-hosts

Question #:8 - (Exam Topic 2)

Create a playbook called balance.yml as follows:

* The playbook contains a play that runs on hosts in balancers host group and uses

the balancer role.

--> This role configures a service to loadbalance webserver requests between hosts

in the webservers host group.curl

--> When implemented, browsing to hosts in the balancers host group (for example

http://node5.example.com)

should produce the following output:

Pass Your Certification With Marks4sure Guarantee 16 of 22


Practice Test RedHat - EX294

Welcome to node3.example.com on 192.168.10.z

--> Reloading the browser should return output from the alternate web server:

Welcome to node4.example.com on 192.168.10.a

* The playbook contains a play that runs on hosts in webservers host group and uses

the phphello role.

--> When implemented, browsing to hosts in the webservers host group with the URL /

hello.php should produce the following output:

Hello PHP World from FQDN

--> where FQDN is the fully qualified domain name of the host. For example,

browsing

to http://node3.example.com/hello.php, should produce the following output:

Hello PHP World from node3.example.com

Similarly, browsing to http://node4.example.com/hello.php, should produce the

following output:

Hello PHP World from node4.example.com

See the Explanation for complete Solution below.

Explanation
Solution as:

# pwd

/home/admin/ansible/

# vim balancer.yml

---

- name: Including phphello role

hosts: webservers

roles:

Pass Your Certification With Marks4sure Guarantee 17 of 22


Practice Test RedHat - EX294

- ./roles/phphello

- name: Including balancer role

hosts: balancer

roles:

- ./roles/balancer

wq!

# ansible-playbook balancer.yml --syntax-check

# ansible-playbook balancer.yml

Question #:9 - (Exam Topic 2)

Modify file content.

------------------------

Create a playbook called /home/admin/ansible/modify.yml as follows:

* The playbook runs on all inventory hosts

* The playbook replaces the contents of /etc/issue with a single line of text as

follows:

--> On hosts in the dev host group, the line reads: “Development”

--> On hosts in the test host group, the line reads: “Test”

--> On hosts in the prod host group, the line reads: “Production”

See the Explanation for complete Solution below.

Explanation
Solution as:

# pwd

/home/admin/ansible

# vim modify.yml

---

Pass Your Certification With Marks4sure Guarantee 18 of 22


Practice Test RedHat - EX294

- name:

hosts: all

tasks:

- name:

copy:

content: "Development"

dest: /etc/issue

when: inventory_hostname in groups['dev']

- name:

copy:

content: "Test"

dest: /etc/issue

when: inventory_hostname in groups['test']

- name:

copy:

content: "Production"

dest: /etc/issue

when: inventory_hostname in groups['prod']

wq

# ansible-playbook modify.yml –-syntax-check

# ansible-playbook modify.yml

Question #:10 - (Exam Topic 2)

Generate a hosts file:

Download an initial template file hosts.j2 from http://classroom.example.com/

Pass Your Certification With Marks4sure Guarantee 19 of 22


Practice Test RedHat - EX294

hosts.j2 to

/home/admin/ansible/ Complete the template so that it can be used to generate a file

with a

line for each inventory host in the same format as /etc/hosts:

172.25.250.9 workstation.lab.example.com workstation

* Create a playbook called gen_hosts.yml that uses this template to generate the file

/etc/myhosts on hosts in the dev host group.

* When completed, the file /etc/myhosts on hosts in the dev host group should have a

line for

each managed host:

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

172.25.250.10 serevra.lab.example.com servera

172.25.250.11 serevrb.lab.example.com serverb

172.25.250.12 serevrc.lab.example.com serverc

172.25.250.13 serevrd.lab.example.com serverd

-----------------------------------------------------------------

while practising you to create these file hear. But in exam have to download as per

questation.

hosts.j2 file consists.

localhost localhost.localdomain localhost4 localhost4.localdomain4

::1

localhost localhost.localdomain localhost6 localhost6.localdomain6

-------------------------------------------------------------------

See the Explanation for complete Solution below.

Explanation

Pass Your Certification With Marks4sure Guarantee 20 of 22


Practice Test RedHat - EX294

Solution as:

# pwd

/home/admin/ansible

wget http://classroom.example.com/hosts.j2

# vim hosts.j2

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1

localhost localhost.localdomain localhost6 localhost6.localdomain6

{% for host in groups['all'] %}

{{ hostvars[host]['ansible_facts']['default_ipv4']['address'] }} {{ hostvars[host]

['ansible_facts']['fqdn'] }} {{ hostvars[host]['ansible_facts']['hostname'] }}

{% endfor %}

wq!

# vim gen_hosts.yml

---

- name: collecting all host information

hosts: all

tasks:

- name:

template:

src: hosts.j2

dest: /etc/myhosts

when: inventory_hostname in groups['dev']

wq

# ansible-playbook gen_hosts.yml -–syntax-check

Pass Your Certification With Marks4sure Guarantee 21 of 22


Practice Test RedHat - EX294

# ansible-playbook gen_hosts.yml

Pass Your Certification With Marks4sure Guarantee 22 of 22


About Marks4sure.com
marks4sure.com was founded in 2007. We provide latest & high quality IT / Business Certification Training Exam
Questions, Study Guides, Practice Tests.

We help you pass any IT / Business Certification Exams with 100% Pass Guaranteed or Full Refund. Especially
Cisco, CompTIA, Citrix, EMC, HP, Oracle, VMware, Juniper, Check Point, LPI, Nortel, EXIN and so on.

View list of all certification exams: All vendors

We prepare state-of-the art practice tests for certification exams. You can reach us at any of the email addresses listed
below.

Sales: sales@marks4sure.com
Feedback: feedback@marks4sure.com
Support: support@marks4sure.com

Any problems about IT certification or our products, You can write us back and we will get back to you within 24
hours.

You might also like