Open Avish34 opened 1 year ago
Hi @Avish34 !
Can you please share your playbook and would you be willing to use our AOS-CX Collection instead of the role? We've stopped supporting the role for development and are now primarily focusing on increasing feature breadth and quality on the Collection.
For examples on how to use the collection you can see our workflows Github and here's a link to a specific SSH/CLI module usecase. You may need to remove the variable ansible_python_interpreter
from your playbook-
Hi, @tchiapuziowong. I was hitting some error while using ansible collection, let me post that as well.
The full traceback is:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 147, in run
res = self._execute()
File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 620, in _execute
self._connection = self._get_connection(cvars, templar)
File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 913, in _get_connection
ansible_playbook_pid=to_text(os.getppid())
File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 573, in get
obj = obj(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/network_cli.py", line 343, in __init__
self._terminal = terminal_loader.get(self._network_os, self)
File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 552, in get
self._module_cache[path] = self._load_module_source(name, path)
File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 530, in _load_module_source
module = imp.load_source(to_native(full_name), to_native(path), module_file)
File "/home/avish/.ansible/collections/ansible_collections/arubanetworks/aoscx/plugins/terminal/aoscx.py", line 38
re.compile(rb"[\r\n]?[\w\+\-\.:\/\[\]]+(?:\([^\)]+\)){0,3}(?:[>#]) ?$")
^
SyntaxError: invalid syntax
fatal: [aoscx_1]: FAILED! => {
"msg": "Unexpected failure during module execution.",
"stdout": ""
}
Playbook :
- hosts: all
collections:
- arubanetworks.aoscx
vars:
ansible_connection: network_cli
tasks:
- name: Execute show commands on the switch
aoscx_command:
commands: ['show psm',
'show version']
Hi,
What ansible version ?
The module need Python 3 (don't work with Python 2.x)
Hi,
What ansible version ?
The module need Python 3 (don't work with Python 2.x)
ansible 2.9.27
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/avish/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Nov 16 2020, 22:23:17) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
@Avish34 I would recommend going through Ansible's documentation on how to upgrade/install to a version that uses Python3 https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-and-upgrading-ansible
Once that's done you should follow these instructions for installing the collection and the python requirements: https://github.com/aruba/aoscx-ansible-collection#installation
Hi,
I wanted a help regarding ssh into switch. When I ssh into switch, it takes me to shell prompt. But I want to reach to terminal using anisble. Please help me out. Also using ssh ansible fails because it's not able to run commands in shell prompt.
Shell prompt:
Ansible error :
Terminal