class

Krikri::Host

Inherits Reference < Object

Represents a target host for automation

Constructors

from_json(json : JSON::Any) : Host

Create from JSON (for plugin communication). Uses the ? variants (as_s?/as_i?) rather than .try(&.as_s): try only guards against a missing key (Crystal nil), not a key present with a JSON null value - {"user": null}.try(&.as_s) still raises, since the JSON::Any itself is non-nil even though it wraps null. A host declared without an explicit user (e.g. localhost ansible_connection=local, with no ansible_user=) serializes exactly that way.

Source
new(name : String, user : String | Nil = nil, port : Int32 | Nil = nil)
Source

Instance methods

connection_host

The address the SSH/transport layer actually connects to — either ansible_host (if set in the inventory) or the inventory hostname. Used for display and connection routing throughout the codebase.

Source
name
Source
name=(name : String)
Source
port

nil means "the user never specified a port" - not the same thing as port 22. Only an explicit ansible_port (inventory/CLI) sets this; when nil, SSHManager omits -p entirely so ssh's own resolution (~/.ssh/config Port directives, /etc/ssh/ssh_config) takes over, matching real Ansible's ssh connection plugin. An explicit port still overrides ssh's config exactly as -p always has.

Source
port=(port : Int32 | Nil)

nil means "the user never specified a port" - not the same thing as port 22. Only an explicit ansible_port (inventory/CLI) sets this; when nil, SSHManager omits -p entirely so ssh's own resolution (~/.ssh/config Port directives, /etc/ssh/ssh_config) takes over, matching real Ansible's ssh connection plugin. An explicit port still overrides ssh's config exactly as -p always has.

Source
user
Source
user=(user : String | Nil)
Source
vars
Source
vars=(vars : Hash(String, JSON::Any))
Source