Three questions regarding asynchronous jobs

513 views
Skip to first unread message

Ingmar Schlecht

unread,
Nov 12, 2014, 9:14:31 AM11/12/14
to ansible...@googlegroups.com
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


Ingmar Schlecht

unread,
Dec 4, 2014, 4:25:26 PM12/4/14
to ansible...@googlegroups.com
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

Michael DeHaan

unread,
Dec 4, 2014, 7:29:48 PM12/4/14
to ansible...@googlegroups.com
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.



--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e3b5c01a-f36d-4173-b502-53e56eeb5eb6%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages