Sources:
Use the repo below to create VMs for this practice exam:
After completing all the tasks on this page you can run a validation playbook to check that all steps were completed.
a. SSH to the control node as the 'vagrant' user
b. Browse to /rhce-practice-exam/rhce8/exam1/validation
c. Run the validate.yml playbook:
ansible-playbook validate.yml -k
The playbook will tell you which task (question) has a failure. Review the playbook output to identify where exactly is the error.
Answers can also be found in the answers folder. I would advise to only use it as last resort.
Note: Some questions may depend on the outcome of others. Please read all questions before proceeding.
/home/automation/plays./home/automation/plays/playbooks./home/automation/plays/ansible.cfg to meet the following requirements:
/home/automation/plays/roles, as well as any other path that may be required for the course of the sample exam./home/automation/plays/inventory.Create an inventory file /home/automation/plays/inventory with the following:
id_rsa and id_rsa.pub)./home/automation/plays/adhoc.sh that uses Ansible ad-hoc commands to achieve the following:
/home/automation/.ssh/authorized_keys.Create a playbook /home/automation/plays/playbooks/motd.yml that runs on all inventory hosts and does the following:
/etc/motd with text. Text depends on the host group:
Create a playbook /home/automation/plays/playbooks/sshd.yml that runs on all inventory hosts and configures SSHD daemon as follows:
/etc/motdX11Forwarding is disabledMaxAuthTries is set to 3/home/automation/plays/vars/secret.yml and add the following variables to the file:
/home/automation/plays/vault_key and add 'devops' as the vault password.ansible.cfgsecret.yml.You have been provided with the list of dictonary of users below. Use /home/automation/plays/vars/user_list.yml file to save this content:
YAML1---2users:3- username: alice4uid: 12015- username: vincent6uid: 12027- username: sandy8uid: 22019- username: patrick10uid: 2202
Create the playbook /home/automation/plays/playbooks/users.yml that uses the encrypted vars file /home/automation/plays/secret.yml to achieve the following:
/bin/bash for all users.webservers_rsa and database_rsa) and upload them with the playbook to the respective server groupsAfter running the playbook, users should be able to SSH into their respective servers without passwords (e.g.: from one webserver node to the other webserver node).
Create the playbook /home/automation/plays/playbooks/regular_tasks.yml that runs on servers in the 'proxy' host group and does the following:
/var/log/time.log with the output from the date command.Create the playbook /home/automation/plays/playbooks/repository.yml that runs on all servers and does the following:
ipa.repo)Create a role called 'sample-mysql' and store it in /home/automation/plays/roles. The role should satisfy the following requirements:
/dev/sdb is created.vg_database is created that uses the primary partition created above.lv_mysql is created of size 512MB in the volume group vg_database.lv_mysql is created.lv_mysql is permanently mounted on /mnt/mysql_backups.my.cnf file should be created for root with the credentials./etc/my.cnf.d/mariadb-server.cnf is generated from the my.cnf.j2 Jinja2 template with the following content:Ini1[mysqld]2bind_address = {{ ansible_default_ipv4.address }}3skip_name_resolve4datadir=/var/lib/mysql5socket=/var/lib/mysql/mysql.sock67symbolic-links=08sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES910[mysqld_safe]11log-error=/var/log/mysqld.log12pid-file=/var/run/mysqld/mysqld.pid
Create a playbook /home/automation/plays/playbooks/mysql.yml that uses the role and runs on hosts in the 'database' group.
Create a role called 'sample-apache' and store it in /home/automation/plays/roles. The role should satisfy the following requirements:
/var/www/html/index.html or /etc/httpd/conf/httpd.conf are modified.Listen directive should be Listen [internal IPv4 address variable]:80 (without the [])index.html.j2 is used to create the file /var/www/html/index.html with the following content:1The address of the server is: [internal IPv4 address variable]Create the playbook /home/automation/plays/playbooks/apache.yml that uses the role and runs on hosts in the 'webservers' host group.
Use Ansible Galaxy to download and install 'geerlingguy.haproxy' role in /home/automation/plays/roles.
Create a playbook /home/automation/plays/playbooks/haproxy.yml that runs on servers in the 'proxy' host group and does the following:
If your playbook works, then doing curl http://node1.ansi.example.com/ should return output from the web server (see task #10). Running the command again should return output from the other web server.
Note: It won't work the same from a web browser
Create the playbook /home/automation/plays/playbooks/selinux.yml that runs on hosts in the 'webservers' host group and does the following:
If you registered your control node with a Red Hat developer subscription, you can install the required package with dnf. Otherwise, an rpm package is available at /home/vagrant/
Create the playbook /home/automation/plays/playbooks/sysctl.yml that runs on all inventory hosts and does the following:
Create the playbook /home/automation/plays/playbooks/archive.yml that runs on hosts in the 'database' host group and does the following:
/mnt/mysql_backups/database_list.txt is created that contains the following line: dev,test,qa,prod./mnt/mysql_backups/database_list.txt is created and stored in /mnt/mysql_backups/archive.gz.Create the playbook /home/automation/plays/playbooks/facts.yml that runs on hosts in the 'database' host group and does the following:
server_role=mysql is created that can be retrieved from ansible_local.custom.sample_exam when using Ansible setup module.Create the playbook /home/automation/plays/playbooks/packages.yml that runs on all inventory hosts and does the following:
Create the playbook /home/automation/plays/playbooks/target.yml that runs on hosts in the 'webservers' host group and does the following:
Create the playbook /home/automation/plays/playbooks/server_list.yml that does the following:
server_list.j2 to create a file /etc/server_list.txt on hosts in the 'database' host group./etc/server_list.txt is owned by the 'automation' user.After running the playbook, the content of the file /etc/server_list.txt should be the following:
1node1.ansi.example.com node2.ansi.example.com node3.ansi.example.comIf the FQDN of any inventory host changes, re-running the playbook should update the file with the new values.