【发布时间】:2020-02-20 14:26:36
【问题描述】:
编辑:经过一些研究,我想知道这是否与本文所述的 on_become() 函数有关? https://github.com/Dell-Networking/ansible-dellos-examples/issues/12
我正在尝试在运行 OS6 的戴尔 2048p 交换机上备份当前配置。无论我将超时设置为什么(使用 ansible.cfg 中的 persistent_connection),它仍然会出错。我检查了交换机上的日志,它同时获得了 show ver 和 show running-config 命令,但它只是没有返回。我查看了网络和故障排除指南,但无法获得正确的错误。有没有人有这个工作,或者发现任何我可以改变的东西?
版本
ansible 2.9.5
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/me/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0]
剧本
-
name: Show ver
hosts: Dell
connection: network_cli
gather_facts: yes
tasks:
-
name: "Get Dell EMC OS6 Show version"
dellos6_command:
commands: ['show version']
register: show_ver
-
name: "Backup config file locally"
dellos6_config:
backup: yes
backup_options:
dir_path: "/mnt/c/Users/me/Documents/Programming Projects/netBackupPlaybooks"
filename: "{{ inventory_hostname }}"
authorize: yes
register: backup_dellso6_location
when: ansible_network_os == 'dellos6'
- debug: var=show_ver
- debug: var=backup_dellos6_location
库存
[Dell]
sw1 ansible_host=10.10.10.10 ansible_ssh_extra_args='-o StrictHostKeyChecking=no' ansible_ssh_common_args='-o StrictHostKeyChecking=no' ansible_network_os=dellos6 ansible_connection=network_cli ansible_become_method=enable ansible_become_password=admin ansible_user=admin ansible_password=admin
sw2 ansible_host=10.10.10.11 ansible_ssh_extra_args='-o StrictHostKeyChecking=no' ansible_ssh_common_args='-o StrictHostKeyChecking=no' ansible_network_os=dellos6 ansible_connection=network_cli ansible_become_method=enable ansible_become_password=admin ansible_user=admin ansible_password=admin
命令
sudo ansible-playbook -i inventory.ini DellPB.yaml -vvvv
错误
The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
File "/tmp/ansible_dellos6_config_payload_pjEND4/ansible_dellos6_config_payload.zip/ansible/module_utils/network/dellos6/dellos6.py", line 86, in get_config
return _DEVICE_CONFIGS[cmd]
fatal: [sw2]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"after": null,
"auth_pass": null,
"authorize": true,
"backup": true,
"backup_options": null,
"before": null,
"config": null,
"host": null,
"lines": null,
"match": "line",
"parents": null,
"password": null,
"port": null,
"provider": null,
"replace": "line",
"save": false,
"src": null,
"ssh_keyfile": null,
"timeout": null,
"update": "merge",
"username": null
}
},
"msg": "unable to retrieve current config",
"stderr": "command timeout triggered, timeout value is 30 secs.\nSee the timeout setting options in the Network Debug and Troubleshooting Guide.",
"stderr_lines": [
"command timeout triggered, timeout value is 30 secs.",
"See the timeout setting options in the Network Debug and Troubleshooting Guide."
]
【问题讨论】:
-
在您发布的代码中,您在哪里更改了超时时间?
invocation.module_args.timeout是null,这意味着它将使用默认超时值。此外,超时问题通常不是“超时问题”,而是因为它正在等待一些提示或某些防火墙规则不正确。到目前为止,您为此采取了哪些故障排除步骤? -
我将持久连接超时设置为 600,只是为了排除复制时它实际上没有被中断。至于防火墙,我可以从运行 Ansible 的机器上 ssh 并执行任务(我可能误解了你所说的防火墙的意思)。如何验证它是否正在等待提示?
标签: ansible