Cisco CCNA (200-301)Automation and ProgrammabilityHard
An engineer runs an Ansible playbook containing the following task against Cisco IOS switches: - name: Create VLAN 10 cisco.ios.ios_vlans: config: - vlan_id: 10 name: SALES state: merged What is the effect of setting 'state: merged' in this task?
- AIt replaces the entire VLAN database with only VLAN 10
- BIt deletes all existing VLANs before applying VLAN 10
- CIt causes the playbook to fail if VLAN 10 already exists
- DIt combines the specified VLAN 10 configuration with existing VLANs, leaving others untouched
Show answer & explanationAnswer & explanation
Correct answer: D. It combines the specified VLAN 10 configuration with existing VLANs, leaving others untouched
The 'merged' state in Cisco IOS Ansible resource modules combines the specified configuration with the device's existing configuration, adding or updating only what is defined without removing unrelated existing settings. 'Replaced' or 'overridden' states would have more destructive effects on other VLANs.
Why the other options are wrong
- A. Replacing the entire VLAN database describes 'overridden' state behavior, not 'merged'.
- B. Deleting all VLANs first describes destructive behavior more consistent with 'overridden' state, not 'merged'.
- C. Ansible resource modules with 'merged' state update existing matching entries rather than failing on duplicates.
Ansible Resource Module States
Cisco IOS Ansible resource modules use a 'state' parameter (merged, replaced, overridden, deleted) to control how declared configuration interacts with existing device configuration.
- merged: combines new config with existing, non-destructive
- replaced: replaces only the specified config section
- overridden: replaces entire config type, removing unspecified items
- deleted: removes specified configuration
Memory trick: Merged blends in, Overridden wipes out.