我尝试运行Ansible模块junos_cli和junos_rollback,得到以下错误:
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/home/quake/network-ansible/roles/junos-rollback/tasks/main.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- name: I've made a huge mistake
^ here这就是我们要讨论的角色:
---
- name: I've made a huge mistake
junos_rollback:
host={{ inventory_hostname }}
user=ansible
comment={{ comment }}
confirm={{ confirm }}
rollback={{ rollback }}
logfile={{ playbook_dir }}/library/logs/rollback.log
diffs_file={{ playbook_dir }}/configs/{{ inventory_hostname }}下面是Juniper页面:http://junos-ansible-modules.readthedocs.io/en/1.3.1/junos_rollback.html
他们的例子的语法有点奇怪。host使用冒号,而其余的使用=符号。我尝试将两者混合在一起,只使用其中一种。我一直收到错误。
我还确认我的junos-eznc版本高于1.2.2 (我有2.0.1)
我之前已经能够使用junos_cli了,我不知道是否发生了版本不匹配。在官方的Ansible文档中,没有提到junos_cli或junos_rollback。也许它们不再被支持了?
http://docs.ansible.com/ansible/list_of_network_modules.html#junos
谢谢,
发布于 2017-04-05 14:31:33
junos_cli和junos_rollback是银河的一部分,而不是核心模块。你可以在https://galaxy.ansible.com/Juniper/junos/上找到它们
这里发布的内容是否包含了您的攻略的全部内容?如果是,您还需要在您的行动手册中定义其他项目,如角色、连接、本地。例如
参考https://github.com/Juniper/ansible-junos-stdlib#example-playbook
```javascript主机:全部
roles:
连接:本地
no:gather_facts
任务:
- name: I've made a huge mistake junos_rollback: host = {{inventory_hostname}} ---- ----发布于 2017-11-02 01:21:36
你把juniper.junos模块的内容保存在哪里了?您能否发布攻略的内容和tree命令的输出,以查看您的文件结构?这可能会有所帮助。
我遇到了一个类似的问题,Ansible找不到我的模块,我所做的就是将juniper.junos文件夹复制到我的roles文件夹中,然后在其中添加一个tasks文件夹,以便从那里执行main.yaml。
如下所示:/Users/macuared/Ansible_projects/roles/Juniper.junos/tasks
---
- name: "TEST 1 - Gather Facts"
junos_get_facts:
host: "{{ inventory_hostname}}"
user: "uuuuu"
passwd: "yyyyyy"
savedir: "/Users/macuared/Ansible_projects/Ouput/Facts"
ignore_errors: True
register: junos
- name: Checking Device Version
debug: msg="{{ junos.facts.serialnumber }}"此外,我会将"“添加到YAML中的字符串值中。如下所示:
---
- name: I've made a huge mistake
junos_rollback:
host="{{ inventory_hostname }}"
user=ansible
comment="{{ comment }}"
confirm={{ confirm }}
rollback={{ rollback }}
logfile="{{ playbook_dir }}/library/logs/rollback.log"
diffs_file="{{ playbook_dir }}/configs/{{ inventory_hostname }}"关于这一点,“我试着将两者混合在一起,只使用其中一种。我一直收到错误。”
我只使用了冒号,即使在文档中建议=符号时,我的也能正常工作。请参阅junos_get_facts
https://stackoverflow.com/questions/43216000
复制相似问题