Skip to content
Back to skills

Ansible Knowledge Patch

ASecurity

Ansible Core

  • 25 stars
  • 0 votes
  • 0 copies
  • 7 views
  • Added September 5, 2026
ai-agentspythonrustgoshellnodeexpresstestinggitapisecurity

Works with

  • terminal
  • cli
  • api

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill ansible-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ansible Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ansible Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-ansible-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-ansible-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ansible-knowledge-patch
description: Ansible Core
version: "2.21.7"
license: MIT
metadata:
  author: Nevaberry
---


# Ansible Core Compatibility Guidance

Load this skill when updating playbooks, custom plugins, modules, connections,
inventory, Galaxy workflows, or test environments affected by compatibility
changes. Use the quick reference for migration decisions and the topic files
for complete behavior, conditions, and examples.

## Reference index

| Reference | Topics |
| --- | --- |
| [Templating, Values, and Conditionals](references/templating.md) | Trust, conditionals, nulls, omitted and undefined values, mutation, JSON, vaulted YAML |
| [Connections and Privilege Escalation](references/connections-and-privilege.md) | SSH, PSRP, credentials, privilege escalation, worker terminals, connection permissions |
| [Modules, Facts, Results, and Windows](references/modules-facts-and-windows.md) | Packages, files, facts, result fields, password hashing, Windows and PowerShell |
| [Playbooks, CLI, Inventory, and Galaxy](references/playbooks-cli-and-inventory.md) | Task syntax, play validation, projections, loops, roles, inventory, collection and role installation |
| [Plugins and Extensions](references/plugins-and-extensions.md) | API migrations, callbacks, action and lookup contracts, extension discovery, credential masking |
| [Testing, Runtime Support, and Security](references/testing-runtime-and-security.md) | Runtime requirements, maintenance, managed test environments, target selection, sanity checks, security reference links |

## Breaking changes and deprecations

### Template trust and boolean conditions

In 2.19, template strings are evaluated only when tagged as trusted; plugins
must apply or preserve trust. `allow_unsafe_lookups` is ignored. Rewrite nested
templates as single expressions. Remove delimiters from conditions unless a
whole-value template resolves to a trusted literal expression string.

Non-boolean conditions are errors by default. `ALLOW_BROKEN_CONDITIONALS`
downgrades them to deprecation warnings and treats literal null or empty-string
conditions as true.

### Null, omitted, and undefined values

In 2.19, a single native expression can produce `None`, and
`DEFAULT_NULL_REPRESENTATION` is ignored. From 2.19.1, null nodes within a
multi-node template render as empty text; a module argument declared as `str`
receives an empty string for `None`.

`omit` is removed from parent containers as soon as they are templated. Reapply
it at the task argument with `mode: "{{ item.mode | default(omit) }}"`.
Plugins calling `Templar.template()` must catch `AnsibleValueOmittedError` when
the entire result is omitted. Unresolved `omit` sentinels fail serialization.

Undefined inputs propagate through filters, tests, and lookups unless the
plugin opts in to receiving markers. `DEFAULT_UNDEFINED_VAR_BEHAVIOR` is
ignored. Plugins using `environment.getitem` must opt in or handle
`MarkerError` and return the marker.

### Task syntax, managed text, and fact access

An empty task `args:`, combining `key=value` arguments with `args` on the same
task, and mapping-valued `action` are deprecated in 2.19. Explicit command
arguments can use `ansible.builtin.command: {cmd: /usr/bin/true}`.

Set a regular `ansible_managed` variable in inventory or play variables to
migrate off deprecated `DEFAULT_MANAGED_STR`; it controls text for both the
template action and lookup.

2.20 deprecates the true default for `INJECT_FACTS_AS_VARS` and schedules a
switch to false by 2.24. Migrate `ansible_os_family` to
`ansible_facts['os_family']` and analogous injected-variable references.

### Transports and connection defaults

In 2.20, use an explicit transport such as `ssh` instead of
`DEFAULT_TRANSPORT=smart`, and remove `PARAMIKO_HOST_KEY_AUTO_ADD` and
`PARAMIKO_LOOK_FOR_KEYS`.

In 2.21.2, the Paramiko plugin and
`ansible.module_utils.compat.paramiko` have been removed; `connection: smart`
and `connection: persistent` no longer fall back to Paramiko.

`psrp` defaults to `host` as the Kerberos SPN service component. Set
`ansible_psrp_negotiate_service: WSMAN` in host variables when the target
requires the previous SPN. A PSRP read timeout marks the host unreachable,
so `ignore_unreachable` applies.

### Package repositories and Galaxy compatibility

`apt_key` and `apt_repository` are deprecated in favor of `deb822_repository`.
In 2.20, remove `install_repoquery` from `dnf` and `dnf5` tasks and `keepcache`
from `yum_repository` tasks. Galaxy servers hosting collections must support
v3 because 2.20 removes the v2 API.

`ansible-galaxy install` and `ansible-galaxy collection install` or `download`
exclude versions whose `requires_ansible` is incompatible with the running
core by default. Set `COLLECTIONS_ON_ANSIBLE_VERSION_MISMATCH` to `ignore`
to allow those versions.

### Plugin and module API migrations

In custom vars plugins, inherit from `BaseVarsPlugin` and implement
`get_vars`; 2.20 removes the `get_host_vars` and `get_group_vars` fallback.
Use the `vars` and `varnames` lookups for playbook access, as the internal
variable cache is scheduled for removal in 2.24.

`has_native_async` and `always_pipeline_modules` are soft-deprecated.
Override `is_pipelining_enabled(self, wrap_async=False)` to customize
pipelining. Strategy plugins outside `ansible.builtin` are deprecated,
have no backward-compatibility guarantees, and face future removal of support.
The `tree` and `oneline` callback documentation marks both plugins deprecated.

Remove the `required` argument to `get_bin_path`, module-utility imports of
`safe_eval`, `auto_legacy` interpreter modes, and the `git` module's
`gpg_whitelist` alias. Module utility migrations, including `ansible.module_utils.six`
and the `basic` platform helper APIs, are detailed in the plugin reference.

Use `fail_json()` in modules or return `failed: true` from actions to report
failure explicitly. Inferring failure from a nonzero `rc` when `failed` is
absent is scheduled for deprecation in 2.22.

## Task results and error handling

### Register projections and current results

`register` can map variable names to Jinja expressions. Projections may
reference other projections in the same task regardless of declaration order.

```yaml
- ansible.builtin.command: /usr/bin/uptime
  register:
    uptime_line: _task.result.stdout
```

Use `_task.result` in `register` or a task conditional such as `failed_when`.
In loops it refers to the latest completed item; `_task.loop_result` exposes
accumulated results. `_task.polymorphic_result` switches from the latest item
to the final aggregate once the loop completes.

### Conditional failures and loop scope

Errors evaluating `when`, `until`, or `failed_when` produce a descriptive task
failure, preserve the task result, and can be handled with `ignore_errors`.
A `break_when` failure preserves loop structure and completed item results.

A templated `ignore_errors` or `ignore_unreachable` that evaluates to true for
any loop item applies to the whole task. Invalid `ignore_errors` values are false.
The playbook reference covers conditional result fields and suppressed exceptions.

Python and PowerShell modules omit `invocation` by default, including in
registered loop items; variable-settable `INJECT_INVOCATION` enables it.
A module or action's `results` key is preserved regardless of value type.
Registered loop results omit `skipped` when it is false.

### Play argument validation: technology preview

`validate_argspec` accepts a spec name or `true` to use the play's name.
Starting in 2.20.5, the validation task receives the `always` tag only when
the play has no tags. The playbook reference includes the play and metadata
file example.

## Connection and module controls

### SSH keys, passwords, and privilege diagnostics

SSH defaults to `SSH_ASKPASS` for passwords and still allows `sshpass`
explicitly. The controller can start or reuse an agent and load key contents
from `ansible_ssh_private_key`, with `ansible_ssh_private_key_passphrase`
for encrypted keys. `SSH_AGENT_EXECUTABLE` overrides the agent executable.

The local connection applies a 10-second `become_success_timeout`.
Setting `become_strip_preamble` to false retains escalation diagnostics in task results.
Use `sudo_chdir` to change directory before invoking sudo when the original
directory would cause permission problems after dropping privileges.

### Repository dependencies and file content

`apt` and `dnf5` accept `auto_install_module_deps`. Set
`install_python_debian: true` on `deb822_repository` to install missing
`python3-debian`. `dnf5` honors `download_dir` with `download_only: true`
in 2.21.5.

`blockinfile` and `lineinfile` accept explicit encodings such as
`encoding: windows-1252`. `replace` matches decoded Unicode text, so review
patterns that depended on byte matching. With `armor: false`,
`ansible.builtin.slurp` returns text without Base64 encoding; use it directly.

### Windows and PowerShell

Running signed modules and scripts on Windows App Control/WDAC hosts is a
technology preview. PowerShell modules can request the execution wrapper with
`#AnsibleRequires -Wrapper` even without importing module utilities.

For 2.21, PowerShell 7.6 is the supported latest LTS alongside Windows
PowerShell 5.1 on Windows targets. Modules can also run via `pwsh` on POSIX
using `Ansible.Basic.cs` for module input and output, subject to Windows API
dependencies in other module utilities.

## Security behavior and test diagnostics

`to_yaml` and `to_nice_yaml` decrypt vaulted values when rendering by default,
so output can contain plaintext secrets. Use `vault_behavior` to control it.

`mask_url` redacts embedded URL authentication data, including passwords with
empty usernames. In 2.21.6 it also prevents disclosure of the original URL
when parsing raises an exception. See the plugin reference for affected modules
and the URL lookup.

In 2.21.5, `ansible-test sanity --test validate-modules` accepts `secret` in
plugin option documentation; output masking takes effect in ansible-core 2.22
and later.

`ansible-test env --timeout` causes thread stacks to be dumped as the deadline
approaches. The testing reference covers runtime support, managed remotes,
integration target inclusion, static environment variables, and sanity changes.

Files in this skill

  • SKILL.md8.6 KB
  • coverage.json523 B
  • references/connections-and-privilege.md1.6 KB
  • references/modules-facts-and-windows.md2.8 KB
  • references/playbooks-cli-and-inventory.md2.3 KB
  • references/plugins-and-extensions.md2.2 KB
  • references/templating.md4 KB
  • references/testing-runtime-and-security.md2.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.