在块中运行eos_配置任务时出现Ansible错误
我有一个ansible playbook,可以将一些配置更改推送到eos设备上在块中运行eos_配置任务时出现Ansible错误,ansible,Ansible,我有一个ansible playbook,可以将一些配置更改推送到eos设备上 --- - name: Access list hosts: myhosts connection: network_cli tasks: - name: run change type 1 block: - name: Interface change eos_config: lines: -
---
- name: Access list
hosts: myhosts
connection: network_cli
tasks:
- name: run change type 1
block:
- name: Interface change
eos_config:
lines:
- description {{ change.description.server }} }
- no logging event link-status
parents: interface "{{ interface }}"
- name: Portchannel change
eos_config:
lines:
- description {{ change.description.server }} {{ change.description.nic }}
- switchport trunk allowed vlan none
parents: interface "{{ portchannel }}"
when: changetype == 1
但这就产生了错误
ERROR! 'parents' is not a valid attribute for a Task
The offending line appears to be:
block:
- name: Interface change (change type 1)
^ here
是否有办法在块中运行eos_config命令 根据@zeitounator的评论,缩进错误。
父项在第一个任务中缩进不正确。缩进和新行在yaml中具有语法意义。啊,是这样。谢谢