(2023) EX407 Exam Dumps, Practice Test Questions BUNDLE PACK
Red Hat Certified Specialist Certification EX407 Sample Questions Reliable
NEW QUESTION 24
===================================================================================
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.
Create a playbook called hwreport.yml that produces an output file called /root/
hwreport.txt on all managed nodes with the following information:
------------------------------------------------------------------------------------------------------
--> Inventory host name
--> Total memory in MB
--> BIOS version
--> Size of disk device vda
--> Size of disk device vdb
Each line of the output file contains a single key-value pair.
* Your playbook should:
--> Download the file hwreport.empty from the URL http://classroom.example.com/
hwreport.empty and
save it as /root/hwreport.txt
--> Modify with the correct values.
note: If a hardware item does not exist, the associated value should be set to NONE
----------------------------------------------------------------------------------------------
while practising you to create these file hear. But in exam have to download as per
questation.
hwreport.txt file consists.
my_sys=hostname
my_BIOS=biosversion
my_MEMORY=memory
my_vda=vdasize
my_vdb=vdbsize
Answer:
Explanation:
Solution as:
# pwd
/home/admin/ansible
# vim hwreport.yml
- name:
hosts: all
ignore_errors: yes
tasks:
- name: download file
get_url:
url: http://classroom.example.com/content/ex407/hwreport.empty
dest: /root/hwreport.txt
- name: vdasize
replace:
regexp: "vdasize"
replace: "{{ ansible_facts.devices.vda.size }}"
dest: /root/hwreport.txt
register: op1
- debug:
var: op1
- name: none
replace:
regexp: "vdasize"
replace: NONE
dest: /root/hwreport.txt
when:
op1.failed == true
- name: vdbsize
replace:
regexp: "vdbsize"
replace: "{{ ansible_facts.devices.vdb.size }}"
dest: /root/hwreport.txt
register: op2
- debug:
var: op2
- name: none
replace:
regexp: "vdbsize"
replace: NONE
dest: /root/hwreport.txt
when:
op2.failed == true
- name: sysinfo
replace:
regexp: "{{item.src}}"
replace: "{{item.dest}}"
dest: /root/hwreport.txt
loop:
- src: "hostname"
dest: "{{ ansible_facts.fqdn }}"
- src: "biosversion"
dest: "{{ ansible_facts.bios_version }}"
- src: "memory"
dest: "{{ ansible_facts.memtotal_mb }}"
:wq!
# ansible-playbook hwreport.yml --syntax-check
# ansible-playbook hwreport.yml
NEW QUESTION 25
Consider the following file.
authors:
- joe
- john
editors:
-frank
managers:
editing: josh
authoring: sam
How many lists are defined in the provided file?
- A. 0
- B. 1
- C. 2
- D. 3
Answer: D
Explanation:
There are two lists in the file. Note use of the hyphens.
NEW QUESTION 26
CORRECT TEXT
Using the Simulation Program, perform the following tasks:
1. Use an ansible ad-hoc command, check the connectivity of your servers.
2. Use an ad-hoc ansible command, find the free space of your servers.
3. Use an ad-hoc ansible command, find out the memory usage of your servers.
4. Do an ls -l on the targets /var/log/messages file.
5. Tail the contents of the targets /var/log/messages file.
Answer:
Explanation:
See explanation below.
Explanation:
1. ansible all -m ping
2. ansible all -a "/bin/df -h"
3. ansible all -a "/usr/bin/free"
4. ansible all -a "ls -l /var/log/messages"
5. ansible local -b -a "tail /var/log/messages"
NEW QUESTION 27
Create a playbook calledwebdev.yml . Theplaybook 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.htmlto test
Answer:
Explanation:
See the Explanation for complete Solution below.
Explanation
Solution as:
NEW QUESTION 28
State whether the following statement is true or false.
Ansible tower can be used to manage your ansible systems.
- A. True
- B. False
Answer: A
NEW QUESTION 29
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
Answer:
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
NEW QUESTION 30
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.
Answer:
Explanation:
See the Explanation for complete Solution below.
Explanation
/home/sandy/ansible/apache.yml
/home/sandy/ansible/roles/sample-apache/tasks/main.yml
/home/sandy/ansible/roles/sample-apache/templates/index.html.j2
In /home/sandy/ansible/roles/sample-apache/handlers/main.yml
NEW QUESTION 31
In what format are ansible playbooks written?
- A. XML
- B. YAML
- C. Ansible Proprietary Format (APF)
- D. JSON
Answer: B
NEW QUESTION 32
===================================================================================
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.
Use Ansible Galaxy with a requirements file called /home/admin/ansible/roles/
install.yml to download and install roles to /home/admin/ansible/roles from the
following URLs:
http:// classroom.example.com /role1.tar.gz The name of this role should be balancer
http:// classroom.example.com /role2.tar.gz The name of this role should be phphello
Answer:
Explanation:
Solution as:
# pwd
/home/admin/ansible/roles
# vim install.yml
---
- src: http://classroom.example.com/role1.tar.gz
name: balancer
- src: http://classroom.example.com/role2.tar.gz
name: phphello
:wq!
# pwd
/home/admin/ansible
# ansible-galaxy install -r roles/install.yml -p roles
NEW QUESTION 33
===================================================================================
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.
Create an Ansible vault to store user passwords as follows:
* The name of the vault is valut.yml
* The vault contains two variables as follows:
- dev_pass with value wakennym
- mgr_pass with value rocky
* The password to encrypt and decrypt the vault is atenorth
* The password is stored in the file /home/admin/ansible/password.txt
Answer:
Explanation:
Solution as:
# pwd
/home/admin/ansible
# echo "atenorth" >password.txt
# chmod 0600 password.txt
# ansible-vault create vault.yml --vault-password-file=password.txt
---
- dev_pass: wakennym
- mgr_pass: rocky
:wq
# cat vault.yml
$ANSIBLE_VAULT;1.1;AES256
36383862376164316436353665343765643331393433373564613762666531313034336438353662
3464346331346461306337633632393563643531376139610a343531326130663266613533633562
38623439316631306463623761343939373263333134353264333834353264343934373765643737
3535303630626666370a643663366634383863393338616661666632353139306436316430616334
65386134393363643133363738656130636532346431376265613066326162643437643064313863
6633333537303334333437646163343666666132316639376531
# ansible-vault view vault.yml
password:******
---
- dev_pass: wakennym
- mgr_pass: rocky
NEW QUESTION 34
Where can you find documentation on Ansible modules? (Choose all that apply.)
- A. Ansible online documentation.
- B. The Ansible man page.
- C. Using the ansible-doc command.
- D. The Ansible-Module man page.
Answer: A,C
Explanation:
The ansible-doc command is designed to provide module documentation. Module documentation may be found online.
NEW QUESTION 35
Which of the following are Ansible modules? (Choose all that apply.)
- A. setup
- B. get_dnshostname
- C. yum
- D. ping
Answer: A,C,D
Explanation:
yum: this module was covered in the lesson and can be found in Ansible documentation.
NEW QUESTION 36
Which of the following are sub commands of the ansible-galaxy command? (Choose all that apply.)
- A. init
- B. find
- C. remove
- D. create
Answer: C
Explanation:
The command ansible-galaxy remove <role> deletes a role installed on the system. The command `ansible-galaxy init <role> creates a shell for a new role in $PWD.
NEW QUESTION 37
Where is Ansible's inventory stored by default?
- A. /home/ansible/inventory
- B. etc/ansible/inventory
- C. .etc/ansible/hosts
- D. ${HOME}/inventory for the currently logged in user
Answer: C
Explanation:
Explanation/Reference:
NEW QUESTION 38
Which flags must be accepted as input for a dynamic inventory script?
- A. --list and --format [file format]
- B. --host [hostname] and --list
- C. --host [hostname] and --inv-list
- D. Only --list
Answer: B
NEW QUESTION 39
What is the primary difference between the shell and command module?
- A. The shell module sets up a shell environment and the command module only runs the provided command.
- B. The shell module is for executing shell commands, and the command module is for Ansible internal commands.
- C. There is no difference.
- D. The shell module sets a default shell whereas the command module executes a shell command.
Answer: A
NEW QUESTION 40
Where is the first place Ansible checks for a role definition?
- A. ${PWD}/roles
- B. Ansible must always be told where to look for a role.
- C. ${PWD}/.roles
- D. /etc/ansible/roles
Answer: A
Explanation:
Ansible always checks the present working directory for a roles directory containing a referenced role definition.
NEW QUESTION 41
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.
Answer:
Explanation:
See the Explanation for complete Solution below.
Explanation
ansible-vault create lock.yml
New Vault Password: reallysafepw
Confirm: reallysafepw
NEW QUESTION 42
What does the when keyword do?
- A. Allows a play to be conditional
- B. Allows a play to be scheduled
- C. There is no when keyword
- D. Allows a task to be conditional
Answer: D
NEW QUESTION 43
Which keywords are valid? (Choose all that apply.)
- A. rescue
- B. always
- C. block
- D. never
Answer: A,B,C
Explanation:
Always is a valid keyword that is part of the block group error handling set of keywords.
Block is a valid keyword that is part of the block group error handling set of keywords.
NEW QUESTION 44
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
Answer:
Explanation:
Solution as:
NEW QUESTION 45
How does a user Access Ansible Tower once it is installed?
- A. By running 'tower-connect' from your local CLI (on a graphical environment) and specifying the hostname of your Ansible Tower server.
- B. By connecting to the control host using ssh and running 'tower-tui'
- C. By running the ansible command and supplying the --tower flag running.
- D. By connecting making an https request to the server tower is installed on using a browser.
Answer: D
Explanation:
Ansible Tower runs a web app and should be accessed using a browser over https.
NEW QUESTION 46
An Ansible inventory may contain which of the following? (Choose all that apply.)
- A. Hosts
- B. Variable declarations
- C. Groups
- D. Plays
Answer: A,B,C
Explanation:
Groups of hosts (and even groups of groups) may be defined within an inventory. The primary purpose of an Ansible inventory is to maintain a list of hosts with which Ansible may interact.
NEW QUESTION 47
Using the Simulation Program, perform the following tasks:
Static Inventories Task:
1. Add a new group to your default ansible host file. call the group [ec2]
2. Add a new host to the new group you created.
3. Add a variable to a new host entry in the /etc/ansible/hosts file. Add the following. localhost http_port=80 maxRequestsPerChild=808
4. Check to see if maxRequestsPerChild is pulled out with an ad-hoc command.
5. Create a local host file and put a target group and then a host into it. Then ping it with an ad-hoc command.
Answer:
Explanation:
1. Edit the /etc/ansible/hosts file. Add a group.
2. Edit the /etc/ansible/hosts file. Add a user under the group you created.
3. Edit the /etc/ansible/hosts file. Find a host. if we add a variable called maxRequestsPerChild to the host it would look like this. host1 maxRequestsPerChild=808
4. ansible ec2 -m shell -a "echo {{ maxRequestsPerChild }}"
5. Edit a local file. It could be called anything. Lets call it myhosts. Inside the file it would have a host like the following. [mygroup] myusername1.mylabserver.com
NEW QUESTION 48
......
Prepare for the Actual Red Hat Certified Specialist EX407 Exam Practice Materials Collection: https://www.actual4labs.com/RedHat/EX407-actual-exam-dumps.html
Red Hat Certified Specialist Certified Official Practice Test EX407: https://drive.google.com/open?id=1KElVi7UetHN_6M0RP8TtHaqbapwu4Kok