Hi team,
i have this playbook:

---
- hosts: "{{ leaf_name }}"
  gather_facts: no
  connection: local
 
  vars_prompt:

  - name: "leaf_name"
    prompt: "Enter switch hostname/ip"
    private: no
  - name: "vlan_id"
    prompt: "Enter access vlan  for L2 ACCESS setup (example 10)"
    private: no

  vars:
    cli:
      username: admin
      password: password
      transport: cli

  tasks:

  - name: Checking configuration for  vlan {{ vlan_id }}
    ignore_errors: true
    nxos_command:
      commands: show vlan id {{ vlan_id }}
      provider: "{{ cli }}"
    register: output
    

  - debug: var=output.stdout_lines
  - debug:
      msg="Looks like  switch {{ leaf_name }} has no vlan {{ vlan_id }}."
    when: output.stdout_lines is not defined

The questions is: i want to get output if van exist and get message "Looks 
like  switch {{ leaf_name }} has no vlan {{ vlan_id }}" if it doesn't. 
What i must add to this playbook ?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fd58048b-291e-46e9-9a2f-f2724bcbcffb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to