nerdexam
Cisco

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.

Network Automation

Question

name: VRFs ios_vrf vrf: "{{local_vrfs}}" state: present purge: yes

Exhibit

350-901 question #50 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)
  • A
    3% (1)
  • B
    9% (3)
  • C
    3% (1)
  • D
    84% (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.

AVRFs not defined in the host_vars file are removed from the device.

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.

BVRFs not defined in the host_vars file are added to the device, and any other VRFs on the device remain.

The 'purge: yes' parameter explicitly removes VRFs not in the defined list; it does not preserve other existing VRFs on the device.

CVRFs defined in the host_vars file are removed from 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.

DVRFs are added to the device from the host_vars file, and any other VRFs on the device are removed.Correct

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

#Ansible#Network Automation#VRF#Idempotence

Community Discussion

No community discussion yet for this question.

Full 350-901 Practice