The cv_tag_v3 module creates workspaces in CloudVision under which to make the tag changes. Sometimes these workspaces are created with the same name as previously created instances, resulting in the error shown in the logs.
Impact:
The application of the tags fails.
Workaround:
Running the play again will probably work.
An image of the workspace that had already been created in a run in June 2023, when the clash occurred in October 2023.
Which component(s) of AVD impacted
cv_tag_v3
How do you run AVD ?
Ansible CLI (with virtual-env or native python)
Input variables
The inputs to `cv_tag_v3` would be correct ones. The issue is intermittent and hard to reproduce on new CV instances as it involves certain amount of randomness to result in a clash.
Steps to reproduce
The inputs to `cv_tag_v3` would be correct ones. The issue is intermittent and hard to reproduce on new CV instances as it involves certain amount of randomness to result in a clash.
The issue was observed on a CloudVision instance that already had 700+ such workspaces.
I believe that although we use 3 random digits from 36 possible digits to get a possible 42840 combinations, due to the birthday paradox, the number of workspaces that need to exist for us to have a 50% chance of a clash is much much lower than 50% of 42840 . (my very rough approximation came to 260 workspaces where we start nearing a 50% chance of a clash)
Relevant log output
To produce the following output, small change was made in the `ansible-cvp/ansible_collections/arista/cvp/plugins/module_utils/tag_tools.py` to print the value of the workspace being used. As can be seen in the logs, the new workspace is `AnsibleWorkspacePE7`, however this was already used in a previous run some months before, as shown in the image in the summary.
fatal: [dc1-pod1-spine2 -> cv_server({{ lookup('ansible.builtin.env', 'CVP_ADDRESS') }})]: FAILED! => {"changed": false, "module_stderr": "/home/avd/.local/lib/python3.9/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host '10.255.80.125'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
/home/avd/.local/lib/python3.9/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host '10.255.80.125'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
/home/avd/.local/lib/python3.9/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host '10.255.80.125'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
Traceback (most recent call last):
File \"/home/avd/.ansible/tmp/ansible-local-68860f4n72lim/ansible-tmp-1696611289.5576265-70395-160404142420129/AnsiballZ_cv_tag_v3.py\", line 107, in <module>
_ansiballz_main()
File \"/home/avd/.ansible/tmp/ansible-local-68860f4n72lim/ansible-tmp-1696611289.5576265-70395-160404142420129/AnsiballZ_cv_tag_v3.py\", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File \"/home/avd/.ansible/tmp/ansible-local-68860f4n72lim/ansible-tmp-1696611289.5576265-70395-160404142420129/AnsiballZ_cv_tag_v3.py\", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.arista.cvp.plugins.modules.cv_tag_v3', init_globals=dict(_module_fqn='ansible_collections.arista.cvp.plugins.modules.cv_tag_v3', _modlib_path=modlib_path),
File \"/usr/local/lib/python3.9/runpy.py\", line 225, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File \"/usr/local/lib/python3.9/runpy.py\", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File \"/usr/local/lib/python3.9/runpy.py\", line 87, in _run_code
exec(code, run_globals)
File \"/tmp/ansible_arista.cvp.cv_tag_v3_payload_70ppduse/ansible_arista.cvp.cv_tag_v3_payload.zip/ansible_collections/arista/cvp/plugins/modules/cv_tag_v3.py\", line 298, in <module>
File \"/tmp/ansible_arista.cvp.cv_tag_v3_payload_70ppduse/ansible_arista.cvp.cv_tag_v3_payload.zip/ansible_collections/arista/cvp/plugins/modules/cv_tag_v3.py\", line 289, in main
File \"/tmp/ansible_arista.cvp.cv_tag_v3_payload_70ppduse/ansible_arista.cvp.cv_tag_v3_payload.zip/ansible_collections/arista/cvp/plugins/module_utils/tag_tools.py\", line 121, in tasker
File \"/tmp/ansible_arista.cvp.cv_tag_v3_payload_70ppduse/ansible_arista.cvp.cv_tag_v3_payload.zip/ansible_collections/arista/cvp/plugins/module_utils/tag_tools.py\", line 117, in tasker
File \"/home/avd/.local/lib/python3.9/site-packages/cvprac/cvp_api.py\", line 3303, in workspace_config
return self.clnt.post(workspace_url, data=payload)
File \"/home/avd/.local/lib/python3.9/site-packages/cvprac/cvp_client.py\", line 934, in post
return self._make_request('POST', url, timeout, data=data, files=files)
File \"/home/avd/.local/lib/python3.9/site-packages/cvprac/cvp_client.py\", line 645, in _make_request
response = self._send_request(req_type, full_url, timeout,
File \"/home/avd/.local/lib/python3.9/site-packages/cvprac/cvp_client.py\", line 821, in _send_request
self._is_good_response(response, '%s: %s ' %
File \"/home/avd/.local/lib/python3.9/site-packages/cvprac/cvp_client.py\", line 440, in _is_good_response
raise CvpRequestError(msg)
cvprac.cvp_client_errors.CvpRequestError: POST: https://10.255.80.125:443/api/resources/workspace/v1/WorkspaceConfig : Request Error: Bad Request - {\"code\":9, \"message\":\"closed workspace cannot be modified\"}
", "module_stdout": "POST: https://10.255.80.125:443/api/resources/workspace/v1/WorkspaceConfig : Request Error: Bad Request - {\"code\":9, \"message\":\"closed workspace cannot be modified\"}
id: AnsibleWorkspacePE7 | name: AnsibleWorkspacePE7
", "msg": "MODULE FAILURE
See stdout/stderr for the exact error", "rc": 1}
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Issue Summary
The
cv_tag_v3
module creates workspaces in CloudVision under which to make the tag changes. Sometimes these workspaces are created with the same name as previously created instances, resulting in the error shown in the logs.Impact:
Workaround:
An image of the workspace that had already been created in a run in June 2023, when the clash occurred in October 2023.![image](https://github.com/aristanetworks/ansible-cvp/assets/109683698/e29b1d2c-5459-476d-8009-ecf84ad7aa60)
Which component(s) of AVD impacted
cv_tag_v3
How do you run AVD ?
Ansible CLI (with virtual-env or native python)
Input variables
Steps to reproduce
Relevant log output