Exam Scenario 3 Answers
...

Below are the answers for Exam Scenario 3.

Task 1
...

mkdir {inventories,playbooks,roles,files,templates}

ansible.cfg

Ini
1
[defaults]
2
remote_user = vagrant
3
roles_path = ./roles
4
inventory = ./inventories/lab_inventory.ini
5
ask_pass = true
6

7
[privilege_escalation]
8
become = true
9
become_ask_pass = false
10
become_method = sudo
11
become_user = root

inventories/lab_inventory.ini

Ini
1
[repo]
2
repo.ansi.example.com
3

4
[control]
5
control.ansi.example.com ansible_connection=local
6

7
[dv]
8
node1.ansi.example.com
9
node3.ansi.example.com
10

11
[qa]
12
node2.ansi.example.com
13
node4.ansi.example.com
14

15
[webserver]
16
node[1:3].ansi.example.com
17

18
[sqlserver]
19
node4.ansi.example.com

Task 2
...

sudo dnf install -y rhel-system-roles
Ini
1
roles_path = ./roles:/usr/share/ansible/roles

playbooks/setup-ssh.yml

YAML
1
---
2
- hosts: control
3
become: true
4

5
tasks:
6
- name: "Configure ssh clients"
7
include_role:
8
name: rhel-system-roles.ssh
9
vars:
10
ssh_user: vagrant
11
ssh:
12
StrictHostKeyChecking: no

Task 3
...

playbooks/kernel-parameters.yml

YAML
1
---
2
- hosts: dv
3
become: true
4

5
vars:
6
kernel_settings_sysctl:
7
- name: fs.file-max
8
value: 400000
9
- name: kernel.threads-max
10
value: 65536
11
roles:
12
- rhel-system-roles.kernel_settings