ansible - 在块中运行 eos_config 任务时出现 Ansible 错误
问题描述
我有一个可将一些配置更改推送到 eos 设备的 ansible playbook
---
- 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 的评论,缩进是错误的。
推荐阅读
- mongodb - 集合中的MongoDB搜索有2或3个空格
- vba - Word 宏 - 无需调整大小即可获取原始大小
- julia - JuMP 是否可以使用 VariableRef 作为索引
- flutter - 为什么建议在大型项目中使用 Bloc 模式?
- apache-spark - 从 PySpark 加载数据帧
- python - 如何写入 csv 文件并知道租赁处于活动状态?
- python - Icecast 流切换源而无需客户端停止播放
- javascript - 无法发布/Nodejs
- javascript - 从 node.js 中的消息队列中读取消息
- recursion - Tree InOrder 递归方法说明