module

Krikri::AsyncJobs

AsyncJobs - shared job-status-file conventions for async:/poll:/ async_status:. A background job (spawned as a separate, detached OS process by TaskExecutor#execute_async, not a Fiber - so it keeps running even if it outlives the poll loop or the whole playbook run) writes its result here; async_status: (plugins/async_status.cr) reads it back. Mirrors real Ansible's own ~/.ansible_async/<jid> convention, though only for local connections - see execute_async's own comment for why remote async isn't implemented.

Constants

DIR = File.join(ENV["HOME"]? || "/tmp", ".ansible_async")

Class methods

cleanup(jid : String) : Bool

Deletes one job's status + config files (real Ansible's own async_status mode=cleanup for a single jid). Returns true when anything was removed.

Source
cleanup_all

Removes every job file in the async dir - real Ansible's async_status mode=cleanup with jid: ALL. ~/.ansible_async previously grew without bound for the lifetime of the account. Stray .tmp leftovers from a crashed write are swept too. Returns the number of files removed.

Source
config_path(jid : String) : String
Source
finished?(status : JSON::Any) : Bool
Source
generate_jid
Source
read_status(jid : String) : JSON::Any | Nil
Source
status_path(jid : String) : String
Source
write_status(jid : String, data : JSON::Any) : Nil

Atomic (write-then-rename) so a concurrent reader never sees a half-written file. Written 0600 - status payloads can carry module output, and the DIR path is predictable.

Source