350-901 · Question #50
name: VRFs ios_vrf vrf: "{{local_vrfs}}" state: present purge: yes
The correct answer is D. VRFs are added to the device from the host_vars file, and any other VRFs on the device are removed. The Ansible ios_vrf module with 'state: present' and 'purge: yes' adds the listed VRFs and removes any VRFs on the device not defined in the task.
Question
Exhibit
Options
- AVRFs not defined in the host_vars file are removed from the device.
- BVRFs not defined in the host_vars file are added to the device, and any other VRFs on the device remain.
- CVRFs defined in the host_vars file are removed from the device.
- DVRFs are added to the device from the host_vars file, and any other VRFs on the device are removed.
How the community answered
(32 responses)- A3% (1)
- B9% (3)
- C3% (1)
- D84% (27)
Why each option
The Ansible ios_vrf module with 'state: present' and 'purge: yes' adds the listed VRFs and removes any VRFs on the device not defined in the task.
The VRFs would be removed based on what is defined in the playbook task variable, not directly from the host_vars file as a standalone source.
The 'purge: yes' parameter explicitly removes VRFs not in the defined list; it does not preserve other existing VRFs on the device.
VRFs defined in the task with 'state: present' are created or maintained, not removed; 'state: absent' would be needed to remove specific VRFs.
The 'purge: yes' parameter instructs the ios_vrf module to delete any VRFs present on the device that are not included in the 'vrf' list defined in the task. Combined with 'state: present', this ensures the device's VRF table exactly matches what is declared in the playbook variable, removing any undeclared VRFs.
Concept tested: Ansible ios_vrf module purge behavior
Source: https://docs.ansible.com/ansible/latest/collections/cisco/ios/ios_vrf_module.html
Topics
Community Discussion
No community discussion yet for this question.
