300-910 · Question #106
Drag and Drop Question Drag and drop the code snippets from the bottom onto the boxes in the code to complete the Ansible playbook. Not all options are used. ``yaml --- name: Deploy container hosts: w
This question tests knowledge of Ansible module parameters for the service and firewalld modules, specifically the boolean/state values that control boot persistence and firewall rule activation.
Question
---
- name: Deploy container
hosts: webservers
tasks:
- name: Ensure Apache is installed
yum: name=httpd state=present
- name: Start Apache and enable it to run on boot
service: name=httpd state=started enabled=<BLANK_1>
- name: Create index.html
copy: content="<h1>Hello World!</h1>" dest=/var/www/html/index.html
- name: Configure firewall for HTTP traffic
firewalld: service=http permanent=true state=<BLANK_2> immediate=yes
Snippets to drag:
truepresentstartedactiveenabledabsent
Exhibit
Explanation
This question tests knowledge of Ansible module parameters for the service and firewalld modules, specifically the boolean/state values that control boot persistence and firewall rule activation.
Approach. BLANK_1 should be true: the enabled parameter of the service module accepts a boolean (true/false) to control whether the service starts at boot - enabled=true ensures httpd survives a reboot. BLANK_2 should be enabled: the firewalld module's state parameter uses enabled/disabled (not present/absent, which apply to other contexts) to open or close a service port. The combination of permanent=true and immediate=yes makes the rule persist across reboots AND take effect right now without a firewalld reload.
Concept tested. Ansible module parameter semantics - distinguishing boolean parameters (enabled=true) from state-style string parameters (state=enabled), and understanding the firewalld module's state, permanent, and immediate options for managing firewall rules idempotently.
Reference. Ansible docs: ansible.builtin.service module (enabled param) and ansible.posix.firewalld module (state, permanent, immediate params)
Topics
Community Discussion
No community discussion yet for this question.
