00:00

QUESTION 6

CORRECT TEXT
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.
Solution:
Solution as:
EX407 dumps exhibit

Does this meet the goal?

Correct Answer: A

QUESTION 7

CORRECT TEXT
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.
Solution:
in /home/sandy/ansible/roles vim requirements.yml
EX407 dumps exhibit
Run the requirements file from the roles directory:
ansible-galaxy install -r requirements.yml -p /home/sandy/ansible/roles

Does this meet the goal?

Correct Answer: A

QUESTION 8

CORRECT TEXT
===================================================================================
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 role called apache in "/home/admin/ansible/roles" with the following requirements:
--> The httpd package is installed, enabled on boot, and started.
--> The firewall is enabled and running with a rule to allow access to the web server.
--> template file index.html.j2 is used to create the file /var/www/html/index.html with the output:
Welcome to HOSTNAME on IPADDRESS
--> Where HOSTNAME is the fqdn of the managed node and IPADDRESS is the IP-
Address of the managed node.
note: you have to create index.html.j2 file.
--> Create a playbook called httpd.yml that uses this role and the playbook runs on hosts in the webservers host group.
Solution:
Solution as:
----------
# pwd
/home/admin/ansible/roles/
# ansible-galaxy init apache
# vim apache/vars/main.yml
---
# vars file for apache http_pkg: httpd firewall_pkg: firewalld http_srv: httpd firewall_srv: firewalld rule: http
webpage: /var/www/html/index.html template: index.html.j2
wq!
# vim apache/tasks/package.yml
---
- name: Installing packages yum:
name:
- "{{http_pkg}}"
- "{{firewall_pkg}}" state: latest
wq!
# vim apache/tasks/service.yml
---
- name: start and enable http service service:
name: "{{http_srv}}" enabled: true
state: started
- name: start and enable firewall service service:
name: "{{firewall_srv}}" enabled: true
state: started wq!
# vim apache/tasks/firewall.yml
---
- name: Adding http service to firewall firewalld:
service: "{{rule}}" state: enabled permanent: true immediate: true wq!
# vim apache/tasks/webpage.yml
---
- name: creating template file template:
src: "{{template}}"
dest: "{{webpage}}" notify: restart_httpd
!wq
# vim apache/tasks/main.yml
# tasks file for apache
- import_tasks: package.yml
- import_tasks: service.yml
- import_tasks: firewall.yml
- import_tasks: webpage.yml wq!
# vim apache/templates/index.html.j2
Welcome to {{ ansible_facts.fqdn }} on {{ ansible_facts.default_ipv4.address }}
# vim apache/handlers/main.yml
---
# handlers file for apache
- name: restart_httpd
service: name: httpd
state: restarted wq!
# cd ..
# pwd
/home/admin/ansible/
# vim httpd.yml
---
- name: Including apache role hosts: webservers
pre_tasks:
- name: pretask message debug:
msg: 'Ensure webserver configuration' roles:
- ./roles/apache post_tasks:
- name: Check webserver uri:
url: "http://{{ ansible_facts.default_ipv4.address }}" return_content: yes
status_code: 200 wq!
# ansible-playbook httpd.yml –-syntax-check
# ansible-playbook httpd.yml
# curl http://serverx

Does this meet the goal?

Correct Answer: A

QUESTION 9

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.
Solution:
* 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"

Does this meet the goal?

Correct Answer: A

QUESTION 10

CORRECT TEXT
Create a playbook /home/bob /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".
Solution:
/home/sandy/ansible/apache.yml
EX407 dumps exhibit
/home/sandy/ansible/roles/sample-apache/tasks/main.yml

Does this meet the goal?

Correct Answer: A