【发布时间】:2023-06-27 08:53:01
【问题描述】:
我是 Ansible 的新手,我正在尝试使用 Ansible cisco.nxos 模块从 Cisco Nexus 设备中提取一些典型的显示输出。
我正在使用 playbook 中的 cisco.nxos.nxos_command 模块在 NX-OS 设备上运行 show version。但是,我在 playbook 执行时收到以下错误:
fatal: [Nx-01]: FAILED! =>
msg: Unable to automatically determine host network os. Please manually configure ansible_network_os value for this host
但是,我在清单文件中指定操作系统类型:
[nxos]
Nx-01
[nxos:vars]
ansible_connection=ansible.netcommon.network_cli
**ansible_network_os=cisco.nxos.nxos**
ansible_user=testuser
ansible_ssh_pass=test
这是我正在使用的剧本:
---
- name: show version
hosts: nxos
gather_facts: false
tasks:
- name: show version
cisco.nxos.nxos_command:
commands: show version
register: output
- debug: var=output.stdout_lines
我错过了什么吗?当与cisco.ios 模块一起使用时,完全相同的设置非常适用于 Cisco IOS。
【问题讨论】:
标签: ansible cisco ansible-inventory