Open quistian opened 1 year ago
Hi,
What switch firmware and model ?
Do you have check the log of the switch and also this part of doc ? https://github.com/aruba/aos-switch-ansible-collection#setting-environment-variables
Image stamp: /ws/swbuildm/rel_beluru_qaoff/code/build/lvm(swbuildm_rel_beluru_qaoff_rel_beluru) Dec 9 2021 22:37:35 WC.16.11.0003 591 Boot Image: Primary
Boot ROM Version: WC.16.01.0010 Active Boot ROM: Primary
It's a 2930F
And I am setting the environment variable:
ANSIBLE_NETWORK_GROUP_MODULES=arubaoss ansible-playbook \ --inventory inventory.yml \ -vvvv \ aos-gen-temp.yml
$ grep NETWORK /etc/ansible/ansible.cfg NETWORK_GROUP_MODULES=arubaoss
I can log into the switch manually using ssh.
I find I can use the arubaoss_vlan module as documented using both: ansible_connection: local and network_cli. I can also use the arubaoss_ntp module as documented.
I can't use the arubaoss_config or arubaoss_command modules as per the documentation. My goal is to use the ansible collection and module(s) to save the running configuration to a local file for my 2930 and 2450 switches.
When I use the arubaoss_command module, with any set of commands e.g. show version the error message is: No existing sessions.
When I use the arubaoss_config module as follows to save the running configuration:
- name: snarf running configuration
arubaoss_config:
backup: True
backup_options:
filename: "{{ inventory_hostname }}.cfg"
save_when: always
I receive the error:
"msg": "unable to retrieve current config",
"stderr": "Unable to decode JSON from response to exec_command('show running-config'). Received 'None'.",
The test switch is as follows:
2930F-test(config)# show system
Status and Counters - General System Information
System Name : 2930F-RestAPI-test
System Contact : NOC (416) 978-4621
System Location : none
MAC Age Time (sec) : 300
Time Zone : -300
Daylight Time Rule : Continental-US-and-Canada
Software revision : WC.16.11.0003 Base MAC Addr : 64e881-057100
ROM Version : WC.16.01.0010 Serial Number : TW07HKW2S2
Up Time : 109 days Memory - Total : 337,437,184
CPU Util (%) : 39 Free : 215,594,996
IP Mgmt - Pkts Rx : 3,110,401 Packet - Total : 6600
Pkts Tx : 3,095,281 Buffers Free : 4347
Lowest : 3948
Missed : 0
Any ideas what I can do to get the running configuration file for a AOS switch?
@quistian
ansible run on linux ? windows ? on the ansible runner, you can make ssh connection to the switch ? do you have try to make a capture to see if there is ssh connection to the switch ?
do you have check switch log ?
There is definitely an ssh connection to the switch as I can perform the vlan and ntp commands fine. I can definitely log in manually via ssh using the credentials given to ansibile. I am currently using OpenBSD and ansible version 2.13.4
$ ansible --version
ansible [core 2.13.4]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/russ/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
ansible collection location = /home/russ/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.9.15 (main, Oct 21 2022, 14:01:40) [Clang 13.0.0 ]
jinja version = 3.1.2
libyaml = True
I've now tried to use the config and command modules with ansible on an Ubuntu 20.04 machine. The same problem exists. The modules fail in a slightly different manner, but they still fail. The other modules e.g. the NTP ones work find in network_cli mode.
@quistian you should be using ansible_connection: network_cli
for arubaoss_command and arubaoss_config modules, all other modules (arubaoss_vlan, arubaoss_ntp) use ansible_connection: local
That's what I am doing i.e. using network_cli and using arubaoss_command as follows:
hosts: aos_sws collections:
arubanetworks.aos_switch vars: ansible_network_os: arubanetworks.aos_switch.arubaoss ansible_connection: network_cli
tasks:
The error message is as follows:
Boot ROM Version: WC.16.01.0010 Active Boot ROM: Primary
Update to 16.11 or 16.10 Helped me in my case with my 2530 to from 16.01 to 16.11 in small update steps
Do you have password configuration-control
configured on the switch?
The reason I ask Is I've been having issues with running command / config ansible playbooks and got the same error above:
"stderr": "Unable to decode JSON from response to exec_command('show running-config'). Received 'None'.",
From my testing (using a radius auth user) I was able to get it working by disabling the password config-control.
This is on both 16.10 & 16.11
When I try to do a simple "show run" "show version" I get the error:
No existing session. I have the connection set to network_cli
hosts: aos_test gather_facts: True collections:
arubanetworks.aos_switch vars: ansible_network_os: arubanetworks.aos_switch.arubaoss ansible_connection: network_cli ansible_user: ansible_password:
tasks:
ok: [aos_test_sw] => { "changed": false, "invocation": { "module_args": { "api_version": "None", "commands": [ "show run", "show version" ], "host": null, "interval": 1, "match": "all", "output_file": "./config/aos_test_sw-aos-running-config.txt", "password": null, "port": null, "provider": { "api_version": null, "host": "10.5.9.18", "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "port": 80, "ssh_keyfile": null, "timeout": 30, "transport": "aossapi", "use_proxy": false, "use_ssl": false, "username": "swbackup", "validate_certs": false }, "retries": 10, "ssh_keyfile": null, "timeout": null, "use_ssl": null, "username": null, "validate_certs": false, "wait_for": null } }, "stdout": [ "No existing session", "No existing session" ], "stdout_lines": [ [ "No existing session" ], [ "No existing session" ] ] }