RH294
RH294
THIS IS NOT THE REAL EXAM AND IS ONLY FOR PRACTICE PURPOSES.
One VM will be configured as an Ansible control node. Other four VMs will be used
to apply playbooks to solve the sample exam questions. The following FQDNs will be
used throughout the sample exam.
control.example.com – Ansible control node
node1.example.com – managed node
node2.example.com – managed node
node3.example.com – managed node
There are a couple of requirements that should be met before proceeding further:
control.example.com server has password-less SSH access to all managed servers
(using the root user).
node1:2.example.com servers have a 10GB secondary /dev/sdb disk attached.
There is a regular “user” created on all the servers.
Create a regular user automation with the password of devops. Use this user for all
sample exam tasks.
All playbooks and other Ansible configuration that you create for this sample exam
should be stored in /home/automation/plays.
Create a configuration file /home/automation/plays/ansible.cfg to meet the
following requirements:
The playbook should replace any existing content of /etc/motd with text. Text
depends on the host group.
On hosts in the proxy host group the line should be “Welcome to HAProxy server”.
On hosts in the webserver host group the line should be “Welcome to Apache server”.
On hosts in the database host group the line should be “Welcome to MySQL server”.
Task 4: Configure SSH Server
Create a playbook /home/automation/plays/sshd.yml that runs on all inventory hosts
and configures SSHD daemon as follows:
Users whose user ID starts with 1 should be created on servers in the webservers
host group. User password should be used from the user_password variable.
Users whose user ID starts with 2 should be created on servers in the database host
group. User password should be used from the user_password variable.
All users should be members of a supplementary group wheel.
Shell should be set to /bin/bash for all users.
Account passwords should use the SHA512 hash format.
Each user should have an SSH key uploaded (use the SSH key that you create
previously).
After running the playbook, users should be able to SSH into their respective
servers without passwords.
Task 7: Scheduled Tasks
Create a playbook /home/automation/plays/regular_tasks.yml that runs on servers in
the proxyhost group and does the following:
The httpd, mod_ssl and php packages are installed. Apache service is running and
enabled on boot.
Firewall is configured to allow all incoming traffic on HTTP port TCP 80 and HTTPS
port TCP 443.
Apache service should be restarted every time the file
/home/573855.cloudwaysapps.com/hfjzxghgzg/public_html/html/index.html is modified.
A Jinja2 template file index.html.j2 is used to create the file
/home/573855.cloudwaysapps.com/hfjzxghgzg/public_html/html/index.html with the
following content:
The address of the server is: IPV4ADDRESS
IPV4ADDRESS is the IP address of the managed node.
Create a playbook /home/automation/plays/apache.yml that uses the role and runs on
hosts in the webservers host group.
Task 11: Download Roles From an Ansible Galaxy and Use Them
Use Ansible Galaxy to download and install geerlingguy.haproxy role in
/home/automation/plays/roles.
If a server has more than 2048MB of RAM, then parameter vm.swappiness is set to 10.
If a server has less than 2048MB of RAM, then the following error message is
displayed: Server memory less than 2048MB
Task 14: Use Archiving
Create a playbook /home/automation/plays/archive.yml that runs on hosts in the
database host group and does the following:
Installs tcpdump and mailx packages on hosts in the proxy host groups.
Installs lsof and mailx and packages on hosts in the database host groups.
Task 17: Services
Create a playbook /home/automation/plays/target.yml that runs on hosts in the
webserver host group and does the following: