community.general.from_toml filter – Convert TOML string into dictionary

Note

This filter plugin is part of the community.general collection (version 13.3.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.from_toml.

New in community.general 13.1.0

Synopsis

  • Converts a string containing a TOML document into an Ansible variable

Input

This describes the input of the filter, the value before | community.general.from_toml.

Parameter

Comments

Input

string / required

A string that contains a TOML document.

Examples

- name: Slurp TOML file
  ansible.builtin.slurp:
    src: config.toml
  register: config

- name: Convert data into dictionary
  ansible.builtin.set_fact:
    my_config: "{{ config['content'] | b64decode | community.general.from_toml }}"

Return Value

Key

Description

Return value

dictionary

Dictionary representing the data from the TOML string.

Returned: success

Authors

  • Christian Schürmann (@spike77453)