300-910 · Question #84
Refer to the Exhibit. Drag and drop the code snippets from the bottom onto the boxes in the code in the Ansible playbook to restart multiple services in the correct sequence. Not all options are used.
The task is to fill in the blanks in an Ansible playbook to restart multiple services. Based on the filled-in Ansible playbook example in the source document (page 5), the blanks are likely intended to be: BLANK 1 (hosts): web_service - This targets the group web_service which in
Question
- name: 'Restart web and db servers at once'
hosts: [BLANK 1]
tasks:
- name: 'Restart web and db servers at once'
command:
[BLANK 2]
service:
name: mysql
state: [BLANK 3]
Inventory file:
[db_nodes]
sql_db1
sql_db2
[web_nodes]
web_node1
web_node2
[monitoring]
mn1_node
[web_service:children]
web_nodes
db_nodes
Options: reboot, started, web_service, all, /sbin/shutdown -r, reloadedExhibit
Explanation
The task is to fill in the blanks in an Ansible playbook to restart multiple services. Based on the filled-in Ansible playbook example in the source document (page 5), the blanks are likely intended to be:
BLANK 1 (hosts): web_service
- This targets the group
web_servicewhich includes bothweb_nodesanddb_nodesfrom the inventory.
BLANK 2 (command): reboot
- This placement of
rebootdirectly under thecommandkeyword for a service restart task is highly unconventional in Ansible. If it implies a host reboot, it contradicts the task name "Restart web and db servers". A more typical Ansible approach for restarting a service would be using theservicemodule withstate: restarted, or for rebooting a host, therebootmodule. This part of the suggested solution seems problematic or context-dependent beyond standard Ansible practices.
BLANK 3 (state for mysql service): reloaded
reloadedis a valid state for theservicemodule, used to reload a service's configuration without fully stopping and starting it. While the task name says "Restart",reloadedmight be chosen if a full restart isn't strictly necessary, or ifrestartedwas not an available option.
The remaining options started, all, /sbin/shutdown -r are not used in the depicted solution on page 5.
Topics
Community Discussion
No community discussion yet for this question.
