RedHat ex294 practice test

Red Hat Certified Engineer (RHCE) exam for Red Hat Enterprise Linux 8 Exam

Last exam update: Jul 20 ,2024
Page 1 out of 2. Viewing questions 1-15 out of 20

Question 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.

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


Explanation:
Solution as:


Discussions
0 / 1000

Question 2

Install and configure ansible
User sandy has been created on your control node with the appropriate permissions already, do not
change or modify ssh keys. Install the necessary packages to run ansible on the control node.
Configure ansible.cfg to be in folder /home/sandy/ansible/ansible.cfg and configure to access remote
machines via the sandy user. All roles should be in the path /home/sandy/ansible/roles. The
inventory path should be in /home/sandy/ansible/invenlory.
You will have access to 5 nodes.
node1.example.com
node2.example.com
node3.example.com
node4.exa
mple.com
node5.example.com
Configure these nodes to be in an inventory file where node I is a member of group dev. nodc2 is a
member of group test, node3 is a member of group proxy, nodc4 and node 5 are members of group
prod. Also, prod is a member of group webservers.

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


Explanation:
In/home/sandy/ansible/ansible.cfg
[defaults]
inventory=/home/sandy/ansible/inventory
roles_path=/home/sandy/ansible/roles
remote_user= sandy
host_key_checking=false
[privilegeescalation]
become=true
become_user=root
become_method=sudo
become_ask_pass=false
In /home/sandy/ansible/inventory
[dev]
node 1 .
example.com
[test]
node2.example.com
[proxy]
node3 .
example.com
[prod]
node4.example.com
node5 .
example.com
[webservers:children]
prod

Discussions
0 / 1000

Question 3

Create a playbook /home/sandy/ansible/motd.yml that runs on all inventory hosts and docs the
following: The playbook should replaee any existing content of/etc/motd in the following text. Use
ansible facts to display the FQDN of each host
On hosts in the dev host group the line should be "Welcome to Dev Server FQDN".
On hosts in the webserver host group the line should be "Welcome to Apache Server FQDN".
On hosts in the database host group the line should be "Welcome to MySQL Server FQDN".

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


Explanation:
/home/sandy/ansible/apache.yml

/home/sandy/ansible/roles/sample-apache/tasks/main.yml

Discussions
0 / 1000

Question 4

Create a playbook that changes the default target on all nodes to multi-user tarqet. Do this in
playbook file called target.yml in /home/sandy/ansible

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


Explanation:
- name: change default target
hosts: all
tasks:
- name: change target
file:
src: /usr/lib/systemd/system/multi-user.target dest: /etc/systemd/system/default.target state: link

Discussions
0 / 1000

Question 5

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

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


Explanation:
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

Discussions
0 / 1000

Question 6

Create a playbook called issue.yml in /home/sandy/ansible which changes the file /etc/issue on all
managed nodes: If host is a member of (lev then write "Development" If host is a member of test
then write "Test" If host is a member of prod then write "Production"

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


Explanation:
Solution as:

Discussions
0 / 1000

Question 7

Create a playbook called regulartasks.yml which has the system that append the date to
/root/datefile every day at noon. Name is job 'datejob'

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


Explanation:
Solution as:

Discussions
0 / 1000

Question 8

Create a playbook called timesvnc.yml in /home/sandy/ansible using rhel system role timesync. Set
the time to use currently configured nip with the server 0.uk.
pool.ntp.org
. Enable burst. Do this on
all hosts.

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


Explanation:
Solution as:

Discussions
0 / 1000

Question 9

Create a playbook called webdev.yml in 'home/sandy/ansible. The playbook will create a directory
Avcbdev on dev host. The permission of the directory are 2755 and owner is webdev. Create a
symbolic link from /Webdev to /var/www/html/webdev. Serve a file from Avebdev7index.html
which displays the text "Development" Curl
http://node1.example.com/webdev/index.html
to test

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


Explanation:
Solution as:

Discussions
0 / 1000

Question 10

In /home/sandy/ansible/ create a playbook called logvol.yml. In the play create a logical volume
called Iv0 and make it of size 1500MiB on volume group vgO If there is not enough space in the
volume group print a message "Not enough space for logical volume" and then make a 800MiB Iv0
instead. If the volume group still doesn't exist, create a message "Volume group doesn't exist" Create
an xfs filesystem on all Iv0 logical volumes. Don't mount the logical volume.

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


Explanation:
Solution as:

Discussions
0 / 1000

Question 11

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

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


Explanation:
Solution as:

Discussions
0 / 1000

Question 12

Create a file called specs.empty in home/sandy/ansible on the local machine as follows:
HOST=
MEMORY=
BIOS=
VDA_DISK_SIZE=
VDB_DISK_SIZE=
Create the playbook /home/sandy/ansible/specs.yml which copies specs.empty to all remote nodes'
path /root/specs.txt. Using the specs.yml playbook then edit specs.txt on the remote machines to
reflect the appropriate ansible facts.

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


Explanation:
Solution as:


Discussions
0 / 1000

Question 13

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.

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


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

Discussions
0 / 1000

Question 14

Create an ansible vault password file called lock.yml with the password reallysafepw in the
/home/sandy/ansible directory. In the lock.yml file define two variables. One is pw_dev and the
password is 'dev' and the other is pw_mgr and the password is 'mgr' Create a regular file called
secret.txt which contains the password for lock.yml.

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


Explanation:
ansible-vault create lock.yml
New Vault Password: reallysafepw
Confirm: reallysafepw

Discussions
0 / 1000

Question 15

Create a file called requirements.yml in /home/sandy/ansible/roles a file called role.yml in
/home/sandy/ansible/. The haproxy-role should be used on the proxy host. And when you curl
http://node3.example.com
it should display "Welcome to
node4.example.com
" and when you curl
again "Welcome to
node5.example.com
" The php-role should be used on the prod host.

Mark Question:
Answer:

See the
Explanation for
complete Solution
below.


Explanation:
Solution as:

Check the proxy host by curl
http://node3.example.com

Discussions
0 / 1000
To page 2