Recently while using Ansible async_status module to get status of previously ran async tasks I got an error :-
fatal: [host.example.com]: FAILED! => {"ansible_job_id": "xxxxxx.xxxxxx", "attempts": 1, "changed": false, "finished": 1, "msg": "could not find job", "started": 1}
In Ansible we know that, to run tasks asynchronously we can use async and poll. Also ansible.builtin.async_status module can be used to obtain status of asynchronous task.
This was confusing to me because same task was running a day back. While troubleshooting I tried many things but couldn’t get this working. Later on I realized that this issue was happening on one particular host only, that promoted me to look into host configurations, and then I realized that /home filesystem on that server was full. And then I realized that ansible keeps the “results_file” that we can use to track async tasks status in users home directory (I was using Linux host), and since /home directory for my user was full, ansible was unable to create “results file“, and async_status was failing with error “could not find job”.
Here is an example output of a asynchronous task created using Ansible –
{
"_ansible_no_log": false,
"ansible_job_id": "3319048033224763.579681",
"started": 1,
"changed": true,
"finished": 0,
"results_file": "/home/my-user/.ansible_async/3319048033224763.579681"
}
As you can see if /home directory is full, Ansible won’t be able to create results_file;
Hopefully this will save some troubleshooting to someone out there.
Thank you.