RecursionError: maximum recursion depth exceeded while getting the str of an object

Hi
I’m currently building a network oriented project to configure SNMP + Radius on my Aruba switches. As aruba collection is pretty poor and not so well maintained, I’m able to do what I need using ansible.netcommon.cli_command collection.

For instance, here’s a simple task I use to check if SNMPv3 is already enabled :

  - name: Verification si SNMPv3 est deja active
    ansible.netcommon.cli_command:
      command: |
        sh running-config | include snmpv3 enable
    register: snmp_check

Ansible to switch connection is made through SSH (natively from ansible.netcommon) using Hashicorp Vault variables present in vars.yml :

ansible_hashi_vault_token: "{{ lookup('env','VAULT_ANSIBLE') }}"
approle_id: "{{ lookup('env','VAULT_ROLE_ID') }}"
approle_secret_id: "{{ lookup('env','VAULT_SECRET_ID') }}"


switchs_secrets_vault: "{{ lookup('community.hashi_vault.vault_kv2_get', 'aruba-switch', engine_mount_point='kv/', auth_method='approle', role_id=approle_id, secret_id=approle_secret_id) }}"
ansible_user: "{{ switchs_secrets_vault.secret.login }}"
ansible_password: "{{ switchs_secrets_vault.secret.password }}"

First, I develop my project from a Debian/Ansible VM where Ansible details are :

ansible [core 2.15.9]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] (/usr/bin/python3)
  jinja version = 3.1.4
  libyaml = True

From this platform I don’t have any issues at all.

Now, when I want to try the same project on AWX, I receive the following error :

Loading collection arubanetworks.aos_switch from /runner/requirements_collections/ansible_collections/arubanetworks/aos_switch
<10.6.4.47> attempting to start connection
<10.6.4.47> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /usr/local/bin/ansible-connection
The full traceback is:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 165, in run
    res = self._execute()
  File "/usr/local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 608, in _execute
    socket_path = start_connection(self._play_context, options, self._task._uuid)
  File "/usr/local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 1230, in start_connection
    write_to_file_descriptor(master, options)
  File "/usr/local/lib/python3.9/site-packages/ansible/module_utils/connection.py", line 58, in write_to_file_descriptor
    src = cPickle.dumps(obj, protocol=0)
  File "/usr/lib64/python3.9/copyreg.py", line 71, in _reduce_ex
    state = base(self)
RecursionError: maximum recursion depth exceeded while getting the str of an object

I’m using AWX 23.5.1 with a custom image I made with the same pip modules + os packages I got from my Debian
Why do I get this kind of error on a platform but not on another one ?
Is this a Python related issues or AWX/Ansible ?

I don’t know what tracks I may follow to fix that , need your help !!! :slight_smile:

Gael

Saw on some reddits posts that some people simply upgrade their AWX-EE image to a newer one.
In my case as it’s a custom one, I simply upgrade ansible from ansible-core2.15rc1 to ansible-core2.15.12 and it WORKS !!! :smiley:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.