ini - read data from a ini file

New in version 2.0.

Synopsis

  • The ini lookup reads the contents of a file in INI format key1=value1. This plugin retrieve the value on the right side after the equal sign '=' of a given section [section].
  • You can also read a property file which - in this case - does not contain section.

Parameters

Parameter Choices/Defaults Configuration Comments
_terms
required
they key(s) too look up

Examples

- debug: msg="User in integration is {{ lookup('ini', 'user section=integration file=users.ini') }}"

- debug: msg="User in production  is {{ lookup('ini', 'user section=production  file=users.ini') }}"

- debug: msg="user.name is {{ lookup('ini', 'user.name type=properties file=user.properties') }}"

- debug:
    msg: "{{ item }}"
  with_ini:
    - value[1-2]
    - section: section1
    - file: "lookup.ini"
    - re: true

Return Values

Common return values are documented here, the following are the fields unique to this lookup:

Key Returned Description
_raw
value(s) of the key(s) in the ini file



Status

Author

  • Yannig Perre <yannig.perre(at)gmail.com>

Hint

If you notice any issues in this documentation you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.5/plugins/lookup/ini.html