Closed hphan082-code closed 1 month ago
what do you have when use ansible-playbook with verbose ? (-vvv)
look like it's still trying to access the switch via port 80 instead of SSH. That's odd because I specify it to use network_cli as ansible_connection.
TASK [Backup config to local file] ****************************************************************************************************************************************************************************************
task path: /ansible/playbook.yml:12
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
<192.168.34.15> ESTABLISH LOCAL CONNECTION FOR USER: root
<192.168.34.15> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-69qdjb3avz `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-69qdjb3avz/ansible-tmp-1718899021.082627-72-241889260328650 `" && echo ansible-tmp-1718899021.082627-72-241889260328650="` echo /root/.ansible/tmp/ansible-local-69qdjb3avz/ansible-tmp-1718899021.082627-72-241889260328650 `" ) && sleep 0'
redirecting module_util ansible.module_utils.network.common.config to ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config
redirecting module_util ansible.module_utils.network.common.config to ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config
redirecting module_util ansible.module_utils.network.common.utils to ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils
Using module file /root/.ansible/collections/ansible_collections/arubanetworks/aos_switch/plugins/modules/arubaoss_config.py
<192.168.34.15> PUT /root/.ansible/tmp/ansible-local-69qdjb3avz/tmpt31y2ija TO /root/.ansible/tmp/ansible-local-69qdjb3avz/ansible-tmp-1718899021.082627-72-241889260328650/AnsiballZ_arubaoss_config.py
<192.168.34.15> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-69qdjb3avz/ansible-tmp-1718899021.082627-72-241889260328650/ /root/.ansible/tmp/ansible-local-69qdjb3avz/ansible-tmp-1718899021.082627-72-241889260328650/AnsiballZ_arubaoss_config.py && sleep 0'
<192.168.34.15> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-69qdjb3avz/ansible-tmp-1718899021.082627-72-241889260328650/AnsiballZ_arubaoss_config.py && sleep 0'
<192.168.34.15> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-69qdjb3avz/ansible-tmp-1718899021.082627-72-241889260328650/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
File "/tmp/ansible_arubaoss_config_payload_11906n5b/ansible_arubaoss_config_payload.zip/ansible_collections/arubanetworks/aos_switch/plugins/module_utils/arubaoss.py", line 462, in get_cli_config
return _DEVICE_CONFIGS[cmd]
~~~~~~~~~~~~~~~^^^^^
fatal: [tor-mdf-sw6]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"after": null,
"api_version": "None",
"backup": true,
"backup_options": {
"dir_path": "/path/to",
"filename": "backup.txt"
},
"before": null,
"diff_against": null,
"diff_ignore_lines": null,
"host": null,
"intended_config": null,
"lines": null,
"match": "line",
"parents": null,
"password": null,
"port": null,
"provider": {
"api_version": "None",
"host": "192.168.34.15",
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"port": 80,
"ssh_keyfile": null,
"timeout": 30,
"transport": "aossapi",
"use_proxy": false,
"use_ssl": false,
"username": "manager",
"validate_certs": false
},
"replace": "line",
"running_config": null,
"save_when": "never",
"src": null,
"ssh_keyfile": null,
"timeout": null,
"use_ssl": null,
"username": null,
"validate_certs": false
}
},
"msg": "unable to retrieve current config",
"stderr": "Unable to decode JSON from response to exec_command('show running-config'). Received 'None'.",
"stderr_lines": [
"Unable to decode JSON from response to exec_command('show running-config'). Received 'None'."
]
}
PLAY RECAP ****************************************************************************************************************************************************************************************************************
tor-mdf-sw6 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
do you have confirm with tcpdump capture ?
you can try to add port: 22 on the playbook
@hphan082-code just want to double check you have the NETWORK_OS defined either at execution or in ansible.cfg? Also which version of ansible.netcommon do you have installed?
Hi everyone, I ended up just use SCP to grab the config, been working ok for the last couple days. :(
hello, I'm new so please be gentle. ;) I'm running ansible on a docker container, and trying to run ansible playbook to backup our procurve/aruba collection of switches.
This is my inventory
and this is my yml file
I confirmed I have pylibssh installed, and keep getting "unable to retrieve current co" error.
I confirmed that from the container, if I ssh to the switch, I can get to it normally.