Files
ansible/changelogs/fragments/86398-ansible-config-validate-default-all.yml
T
Apoorv DarshanandGitHub 5149f7c640 ansible-config: default to checking all plugin configs (#87212)
* ansible-config: default validate to checking all plugin configs

ansible-config validate defaulted to -t base, so any configuration file
using a section owned by a plugin (e.g. [ssh_connection]) was reported
as an unknown section, and keys inside such sections were never
validated at all - a stock, perfectly valid ansible.cfg failed
validation out of the box.

Default the validate action to -t all so installed plugin configuration
is taken into account. An explicit -t still narrows validation, and the
other ansible-config actions keep their base default (the -t default is
now resolved per action in post_process_args, since the shared parent
parser action object cannot carry per-subcommand defaults).

Fixes #86398

Signed-off-by: Apoorv Darshan <ad13dtu@gmail.com>

* Move -t to per-default shared parsers built by a factory

Per review: instead of a None sentinel resolved in post_process_args,
provide two small shared parent parsers for -t (one with default
'base', one with default 'all', built by a factory) so each
subcommand's --help states its actual default.

Signed-off-by: Apoorv Darshan <ad13dtu@gmail.com>

* Address review: parametrize ansible-config type tests

Deduplicate the three near-identical tests into a single
@pytest.mark.parametrize with descriptive IDs, return the resolved type
directly from the helper, add return-type annotations, and turn the
helper's leading comment into a docstring.

* Default ansible-config type to all for every action

Broaden the new default as requested in review, while keeping -t base as the compatibility override for users who need the previous behavior. Cover every action and both explicit override paths in the parser tests.

Assisted-by: OpenAI Codex
Signed-off-by: Apoorv Darshan <ad13dtu@gmail.com>

* Move ansible-config default coverage to integration tests

Exercise the public CLI across every action and run existing init, validate, and dump scenarios without an explicit type. Remove the parser-only unit test and use translation-friendly changelog wording.

Assisted-by: OpenAI Codex
Signed-off-by: Apoorv Darshan <ad13dtu@gmail.com>

* Document ansible-config default as breaking

Move the entry into the generated porting-guide section and document the -t base compatibility override.

Assisted-by: OpenAI Codex
Signed-off-by: Apoorv Darshan <ad13dtu@gmail.com>

---------

Signed-off-by: Apoorv Darshan <ad13dtu@gmail.com>
2026-07-17 14:34:17 -04:00

7 lines
386 B
YAML

breaking_changes:
- >-
ansible-config - all actions now default to ``-t all``, so configuration files using sections
owned by plugins (for example, ``[ssh_connection]``) are no longer reported as unknown sections,
and keys within those sections are actually validated. Use ``-t base`` to retain the previous
behavior (https://github.com/ansible/ansible/issues/86398).