Running arbitrary commands on Arista devices
In this recipe, you will execute operational commands on Arista devices and use the output to validate the state of the devices:
- Create a new playbook called
pb_get_vlans.ymland populate it to execute theshow vlancommand on all leaf switches and store the output in a variable:root@cookbook-lab:~/cookbook-lab/chapters/ch04# vi pb_get_vlans.yml --- - name: “Retrieve All VLANs from Leaf Switches” hosts: “leafs” (1) tasks: - name: “Get All VLANs” arista.eos.eos_command: commands: show vlan | json (2) register: show_vlan - name: “Validate VLANs are Present” ansible.builtin.assert: that: (interfaces[item][‘vlan’...