我正在尝试将 ansible 与 Junos 设备一起使用,遵循此文档:
http://docs.ansible.com/ansible/junos_command_module.html
我创建了这个剧本:
- name: run a set of commands
junos_command:
commands: ['show version', 'show ip route']
还有另外一个:
- name: run show version on remote devices
junos_command:
commands: show version
但我收到这些错误:
ERROR! 'junos_command' is not a valid attribute for a Play
The error appears to have been in '/home/joseluis/junos_command.yml': line 1, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: run a set of commands ^ here
我有以下版本:
- ansible 2.3.0.0-1ppa~值得信赖
- 朱诺斯-eznc (2.1.3)
- jxmlease (1.0.1)
我能做些什么?
答案1
您发布的行是任务。
在剧本中,您至少应该指定目标主机和任务。
- hosts: my_hosts
tasks:
- name: run show version on remote devices
junos_command:
commands: show version
看http://docs.ansible.com/ansible/playbooks_intro.html#basics