Documentation

    PLEASE NOTE: This document applies to latest version and not to the latest stable release v2.21

    Documentation for other releases can be found by using the version selector in the top right of any doc page.

    ini_file

    Manage settings in INI-style configuration files.

    Attributes

    check_mode:
      support: full
    

    Parameters

    Parameter Required Type Values Description
    path true string   The absolute path to the INI file to modify.
    section   string   The section name to modify. If not specified, the option will be placed before the first section.
    option true string   The option (key) name to modify.
    value   string   The value to set for the option. Required if state=present.
    state   string present
    absent
    Whether the option should exist or not. [default: "present"]
    no_extra_spaces   boolean   Remove spaces around the = sign. [default: false]

    Examples

    - ini_file:
        path: /etc/app/config.ini
        section: database
        option: host
        value: localhost
        state: present
    
    - ini_file:
        path: /etc/app/config.ini
        section: database
        option: port
        value: "5432"
    
    - ini_file:
        path: /etc/app/config.ini
        section: database
        option: deprecated_option
        state: absent
    
    - ini_file:
        path: /etc/app/config.ini
        section: cache
        option: enabled
        value: "true"
        no_extra_spaces: true