Skip to content

Conversation

@jdrowne
Copy link

@jdrowne jdrowne commented Jan 18, 2026

Summary

New module to manage individual keys in TOML files, similar to ini_file. Supports the complete TOML 1.0.0 specification:

  • All string types (basic, literal, multiline, multiline literal)
  • All integer representations (decimal, hex, octal, binary)
  • Floats with inf/nan support
  • All datetime types (offset, local, date, time)
  • Arrays, tables, inline tables, and arrays of tables

Preserves comments and formatting using the tomlkit library.

Related

Closes the TOML portion of #4686, which attempted to add json, yaml, and toml modules together but was never merged. This PR differs by:

  • Focused scope (TOML only)
  • Uses tomlkit instead of toml library (preserves comments/formatting)
  • Complete TOML 1.0.0 type support

Test plan

  • Integration tests added (tests/integration/targets/toml_file/)
  • CI passed on fork
  • BOTMETA entry added

🤖 Generated with Claude Code

@ansibullbot ansibullbot added integration tests/integration module module new_contributor Help guide this first time contributor plugins plugin (any type) tests tests labels Jan 18, 2026
@jdrowne jdrowne marked this pull request as draft January 18, 2026 01:24
@ansibullbot ansibullbot added the WIP Work in progress label Jan 18, 2026
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI and removed ci_verified Push fixes to PR branch to re-run CI labels Jan 18, 2026
@jdrowne jdrowne marked this pull request as ready for review January 18, 2026 02:24
@ansibullbot ansibullbot removed the WIP Work in progress label Jan 18, 2026
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-12 Automatically create a backport for the stable-12 branch labels Jan 18, 2026
Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jdrowne, thanks for your contribution!!

Here goes a first review.

@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added merge_commit This PR contains at least one merge commit. Please resolve! needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jan 19, 2026
@ansibullbot ansibullbot removed merge_commit This PR contains at least one merge commit. Please resolve! needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Jan 19, 2026
@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Jan 19, 2026
@jdrowne jdrowne force-pushed the toml_file branch 3 times, most recently from fe4004e to 3a0b8fa Compare January 19, 2026 19:41
@ansibullbot ansibullbot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Jan 19, 2026
New module to manage individual settings in TOML files without managing
the entire file. Features include:

- Add, modify, or remove keys in TOML tables
- Support for all TOML 1.0.0 value types (strings, integers, floats,
  booleans, datetimes, arrays, inline tables, etc.)
- Special float values (inf, -inf, nan)
- Alternative integer representations (hex, octal, binary)
- String variants (literal, multiline, multiline literal)
- Array of tables support with indexing
- Nested tables and dotted key support
- Comment and formatting preservation via tomlkit
- Backup file creation
- Check mode and diff mode support

Co-Authored-By: Claude Opus 4.5 <[email protected]>
tomlkit preserves the blank line that preceded a removed table, so the
expected test values need to account for this trailing blank line.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-12 Automatically create a backport for the stable-12 branch check-before-release PR will be looked at again shortly before release and merged if possible. integration tests/integration module module needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR new_contributor Help guide this first time contributor plugins plugin (any type) tests tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants