PLAY [arista] ******************************************************************
TASK [check VLAN] **************************************************************
ok: [arista]
TASK [debug] *******************************************************************
ok: [arista] => {
"msg": "test: [u'VLAN Name Status Ports\\n----- -------------------------------- --------- -------------------------------\\n1 default active Et2, Et3\\n100 VLAN0100 active Et1\\n200 VLAN0200 active \\n']"
}
TASK [interface e01] ***********************************************************
skipping: [arista]
playbook file:
---
- hosts: arista
gather_facts: no
connection: local
strategy: free
tasks:
- name: check VLAN
ignore_errors: yes
eos_command:
host: arista
username: admin
password: ccc
commands:
- show vlan
register: test
- debug:
msg: "test: {{ test.stdout }}"
- name: interface e01
ignore_errors: yes
eos_config:
host: arista
username: admin
password: ccc
authorize: yes
lines:
- switchport access vlan 200
- no shutdown
parents:
- interface Ethernet1
when: '"200" in test'
lines:
- switchport access vlan 200
- description nan
- no shutdown
parents:
- interface e01
when: "'200' in test.stdout"
thanks