ios_command: Max Recursion error when using Custom Credential
Dustin-Wi opened this issue · 5 comments
SUMMARY
Originally identified in the AWX community:
ansible/awx#14689
When trying to execute a Job Template with a single task, I am getting the below error.
{
"msg": "Unexpected failure during module execution: maximum recursion depth exceeded while getting the str of an object",
"exception": "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
",
"stdout": "",
"_ansible_no_log": false
}
ISSUE TYPE
- Bug Report
COMPONENT NAME
cisco.ios
ANSIBLE VERSION
2.15.7rc1
COLLECTION VERSION
ansible-galaxy collection list cisco.ios
# /home/dustin/venvs/a10_iac/a10_iac/collections/ansible_collections
Collection Version
---------- -------
cisco.ios 5.2.0
# /home/dustin/venvs/a10_iac/lib/python3.9/site-packages/ansible_collections
Collection Version
---------- -------
cisco.ios 4.6.1
CONFIGURATION
ansible-config dump --only-changed
COLLECTIONS_PATHS(/home/dustin/venvs/a10_iac/a10_iac/ansible.cfg) = ['/home/dustin/venvs/a10_iac/a10_iac/collections']
CONFIG_FILE() = /home/dustin/venvs/a10_iac/a10_iac/ansible.cfg
DEFAULT_ACTION_PLUGIN_PATH(/home/dustin/venvs/a10_iac/a10_iac/ansible.cfg) = ['/home/dustin/venvs/a10_iac/a10_iac/collections/a10/acos_axapi/plugins/action']
DEFAULT_HOST_LIST(/home/dustin/venvs/a10_iac/a10_iac/ansible.cfg) = ['/home/dustin/venvs/a10_iac/a10_iac/inventory']
DEFAULT_ROLES_PATH(/home/dustin/venvs/a10_iac/a10_iac/ansible.cfg) = ['/home/dustin/venvs/a10_iac/a10_iac/roles']
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = /home/dustin/venvs/a10_iac/.vault_pass.txt
HOST_KEY_CHECKING(/home/dustin/venvs/a10_iac/a10_iac/ansible.cfg) = False
OS / ENVIRONMENT
RHEL: Red Hat Enterprise Linux release 8.8 (Ootpa)
AWX-Operator: 2.7.2
AWX-EE: quay.io/ansible/awx-ee:23.5.0
AWX: 23.4.0
Ansible: 2.15.7rc1
STEPS TO REPRODUCE
Create a custom credential in AWX
Create a playbook that sets "ansible_ssh_pass" to the credential and uses cisco.ios.ios_command module
Execute the playbook in AWX
Additional information
inventory has two hosts with no variables set.
Custom Credential Input Configuration:
fields:
- id: a10_username
type: string
label: Username
- id: a10_password
type: string
label: Password
secret: true
required:
- username
- password
Custom Credential Injection Configuration:
extra_vars:
a10_password: '{{ a10_password }}'
a10_username: '{{ a10_username }}'
Playbook:
---
- name: PLAYBOOK - TEST VARIOUS FEATURES AND FUNCTIONS OF ANSIBLE
connection: ansible.netcommon.network_cli
hosts: all
gather_facts: no
vars:
ansible_network_os: cisco.ios.ios
ansible_user: "{{ a10_username }}"
ansible_ssh_pass: "{{ a10_password }}"
tasks:
- name: TESTING CREDENTIALS
cisco.ios.ios_command:
commands:
- show version
EXPECTED RESULTS
Ansible Job should connect to the devices in the inventory and run the commands.
ACTUAL RESULTS
The playbook fails with an error.
{
"msg": "Unexpected failure during module execution: maximum recursion depth exceeded while getting the str of an object",
"exception": "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
",
"stdout": "",
"_ansible_no_log": false
}
Note that the above occurs under "arubaoss_command" as well.
Playbook
- name: Execute show run on the switch
arubaoss_command:
commands: ['show run']
output_file: /gitlab-repo/ncm/HP/{{inventory_hostname}}.cfg
no_log: true
AWX-EE
23.5.1
Using AWX-EE: quay.io/ansible/awx-ee:23.5.0 seems to work and is not affected.
@Dustin-Wi @git-day, thank you for submitting the issue report. Upon further testing, it seems that the problem is not associated with the cisco.ios collection. It might be related to awx-ee, have you tried a different version of awx-ee.
When I use a previous version of the AWX-EE (23.4.0) it works. I opened an issue over on the AWX issue board, and they directed me here.
ansible/awx#14689
When I use a previous version of the AWX-EE (23.4.0) it works. I opened an issue over on the AWX issue board, and they directed me here. ansible/awx#14689
ahh i see, based on my testing, there does not seem to be an issue with the ios collection, Given that the functionality is preserved in a previous version of AWX-EE, the issue might be associated with AWX-EE. I'll look more into the issue and get back to you.
@roverflow Yeah, I have a workaround and I've reported the issue. I don't know enough to dig deeper to find the root cause, so I'll leave it to the community to solve for now.