nerdexam
Cisco

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

Infrastructure Automation

Question

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.
- 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, reloaded

Exhibit

300-910 question #84 exhibit

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_service which includes both web_nodes and db_nodes from the inventory.

BLANK 2 (command): reboot

  • This placement of reboot directly under the command keyword 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 the service module with state: restarted, or for rebooting a host, the reboot module. This part of the suggested solution seems problematic or context-dependent beyond standard Ansible practices.

BLANK 3 (state for mysql service): reloaded

  • reloaded is a valid state for the service module, used to reload a service's configuration without fully stopping and starting it. While the task name says "Restart", reloaded might be chosen if a full restart isn't strictly necessary, or if restarted was not an available option.

The remaining options started, all, /sbin/shutdown -r are not used in the depicted solution on page 5.

Topics

#Ansible Playbooks#Ansible Inventory#Service Management#Infrastructure as Code

Community Discussion

No community discussion yet for this question.

Full 300-910 Practice