Three questions regarding asynchronous jobs

Hi there,

just three short questions regarding async jobs.

1.) How can I check the async_status of a “fire and forget” job on all my servers at once? So instead of checking a specific server’s job id 115503716196.18657 (mind the dot) I would like to basically check 115503716196.*, which doesn’t work. Also just “115503716196” doesn’t work.

2.) Is there a way to kill “fire and forget” async jobs?

3.) Is there some sort of garbage collection being done for the ~/.ansible_async/ directory or does that grow forever?

Here’s a bit more explanation regarding just my first question, how I can check the async_status of a job on all my servers at once:

Say I’m executing an async job like that:

ansible all -B 90 -P 0 -a “sleep 80”

I get a confirmation of successful start like this:

background launch…

ip_srv1 | success >> {
“ansible_job_id”: “115503716196.18657”,
“results_file”: “/home/ubuntu/.ansible_async/115503716196.18657”,
“started”: 1
}

ip_srv2 | success >> {
“ansible_job_id”: “115503716196.6532”,
“results_file”: “/home/ubuntu/.ansible_async/115503716196.6532”,
“started”: 1
}

Now, is there a way to check the status of the job on all servers at once?

I tried the obvious choice first and did:

ansible all -m async_status -a “jid=115503716196”

However, this just results in:

ip_srv1 | FAILED >> {
“ansible_job_id”: “115503716196”,
“failed”: true,
“msg”: “could not find job”
}

ip_srv2 | FAILED >> {
“ansible_job_id”: “115503716196”,
“failed”: true,
“msg”: “could not find job”
}

Only if I do:

ansible all -m async_status -a “jid=115503716196.18657”

I get what I want - but of course only for the server of which I typed in the concret job id.

54.171.202.93 | success >> {
“ansible_job_id”: “115503716196.18657”,
“changed”: false,
“results_file”: “/home/ubuntu/.ansible_async/115503716196.18657”,
“started”: 1
}

54.72.229.37 | FAILED >> {
“ansible_job_id”: “115503716196.18657”,
“failed”: true,
“msg”: “could not find job”
}

Cheers
Ingmar

Hi there,

just bumping my old question up again.

Especially the first and second question are still of high interest for me (nobody using async jobs in the way I do?):

1.) How can I check the async_status of a “fire and forget” job on all my servers at once? So instead of checking a specific server’s job id 115503716196.18657 (mind the dot) I would like to basically check 115503716196.*, which doesn’t work. Also just “115503716196” doesn’t work.

2.) Is there a way to kill “fire and forget” async jobs?

Best
Ingmar

  1. async_status works on a particular JID but cannot be called on wildcards.

  2. killing fire and forget jobs? Not presently.

  3. For the async directory you would want to delete the leftover files manually. I believe non “fire and forget” jobs do delete the file.