Krikri::Host
Represents a target host for automation
Constructors
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.
Instance methods
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.
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.
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.