Hi team,
i have this playbook:
`
Hi team,
i have this playbook:
`
team,
any ideas?
Hi team,
i have this playbook:---
- hosts: "{{ leaf_name }}"
gather_facts: no
connection: localvars_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: novars:
cli:
username: admin
password: password
transport: clitasks:
- 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
output.stdout_lines is always defined so this will never run.
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 ?
Hard to say, I have never used the nxos_command.
It's always a good idea to provide the content of your output variable, because then you can get help from people that haven't used that module.