team,
any ideas?
вторник, 20 марта 2018 г., 20:25:49 UTC+3 пользователь Cyberbob написал:
>
> 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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/5a088753-db06-48a0-a406-a55de465ae49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.