EX294 • Practice Test 32
Free EX294 practice test — 15 questions with explanations. Set 32. No signup required.
You have an Ansible playbook that uses the 'lineinfile' module to manage the /etc/ssh/sshd_config file. The playbook runs without errors, but after execution, the SSH service becomes unreachable on some hosts. Investigation reveals that the file contains duplicate lines for 'Port 22' and 'PermitRootLogin no'. The playbook uses the following task:
- name: Ensure SSH settings ansible.builtin.lineinfile: path: /etc/ssh/sshd_config regexp: "^{{ item.key }}" line: "{{ item.key }} {{ item.value }}" loop: - { key: 'Port', value: '22' } - { key: 'PermitRootLogin', value: 'no' }
The playbook is run multiple times. What is the most likely cause of the duplicate lines?
Choose an answer to begin — your selection is scored in the full session.
15 questions · instant feedback and full explanations after every question.