The issue is with win_get_url wherein it throws error sporadically on the same scenario on identical cicd VMs. We are utilizing an execution environment to run our playbooks within Ansible Automation Platform. So the info I have provided below came from the configs that are set to build the execution environment.
ISSUE TYPE
Bug Report
COMPONENT NAME
ansible.windows.win_get_url
ANSIBLE VERSION
"ansible_distribution_version": "10.0.14393.0",
COLLECTION VERSION
- name: ansible.windows
version: 1.11.0
CONFIGURATION
OS / ENVIRONMENT
Target OS version is Windows 2019; our cicd server wherein we test our code before promoting it in our main branch.
STEPS TO REPRODUCE
Put a file in Azure blob container, generate sas token and encrypt in ansible-vault, utilize it on your playbook, same error and same location fails sporadically. It cannot be predicted and it is very intermittent. If only we could identify the root cause of it, probably we can put a retry on the ansible task. But the error that we are getting is some kind of a powershell script with a line number error which doesn't exist on our end. It seems like the win_get_url has this particular script and it is failing for a specific condition. Here is the code snippet that is failing sporadically:
- name: Fetch esob_secrets.txt to C:\appl\grafana-alloy-install
ansible.windows.win_get_url:
url: "{{ blob_container_uri }}/windows/secrets/esob_secrets.txt{{ esob_sas_key }}"
dest: C:\appl\grafana-alloy-install\esob_secrets.txt
force: true
when: not alloy_service_name_stat_result.exists or not old_grafana_service_name_stat_result.exists
notify: Reran_startup_script_windows
Can you share the Ansible version you are running with in your EE? Are you running the win_get_url module in parallel on the same host or this just fails randomly on the host?
SUMMARY
The issue is with win_get_url wherein it throws error sporadically on the same scenario on identical cicd VMs. We are utilizing an execution environment to run our playbooks within Ansible Automation Platform. So the info I have provided below came from the configs that are set to build the execution environment.
ISSUE TYPE
COMPONENT NAME
ansible.windows.win_get_url
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Target OS version is Windows 2019; our cicd server wherein we test our code before promoting it in our main branch.
STEPS TO REPRODUCE
Put a file in Azure blob container, generate sas token and encrypt in ansible-vault, utilize it on your playbook, same error and same location fails sporadically. It cannot be predicted and it is very intermittent. If only we could identify the root cause of it, probably we can put a retry on the ansible task. But the error that we are getting is some kind of a powershell script with a line number error which doesn't exist on our end. It seems like the win_get_url has this particular script and it is failing for a specific condition. Here is the code snippet that is failing sporadically:
EXPECTED RESULTS
"msg": "OK", "status_code": 200, "checksum_src": "d22893a6c61b28fc9608f333c2b9ebe66ac70fe0", "checksum_dest": "d22893a6c61b28fc9608f333c2b9ebe66ac70fe0",
ACTUAL RESULTS
{ "exception": "Exception calling \"ExitJson\" with \"0\" argument(s): \"The directory is not empty.\r\n\"\r\nAt line:299 char:1\r\n+ $module.ExitJson()\r\n+, : line 299\r\n",
"msg": "Unhandled exception while executing module: Exception calling \"ExitJson\" with \"0\" argument(s): \"The directory is not empty.\r\n\"",
"_ansible_no_log": null,
"changed": false
}
~~~~~~\r\n + CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException\r\n + FullyQualifiedErrorId : IOException\r\n\r\nScriptStackTrace:\r\nat