Hi Guys,
I want to add a condition to stop execution of playbook if “vlan not found”. I am attaching my playbook tasks below:
-
name: check vlan availability
ios_command:
commands: -
show vlan id {{ vlan1 }}
register: precheck -
name: check voice_vlan availability
ios_command:
commands: -
show vlan id {{ vlan2 }}
register: precheck_voice_vlan -
name: L2 Vlan1 Availability Check
debug:
msg: “Vlan not present in the switch”
when: “‘not found’ in precheck” -
name: L2 Vlan2 Availability Check
debug:
msg: “Vlan not present in the switch”
when: “‘not found’ in precheck_voice_vlan”
===========here I want stop playbook execution if vlan not found========
- name: get interface status from the device
ios_command:
commands: - show run int {{ interface }} | i trunk
register: precheck_int
if Vlan not found in precheck I want to stop further execution .Please help me for this.