key1=value1
. This plugin retrieves the value on the right side after the equal sign '='
of a given section [section]
.Parameter | Choices/Defaults | Configuration | Comments |
---|---|---|---|
_terms - / required | The key(s) to look up | ||
default - | Default: "" | Return value if the key is not in the ini file. | |
encoding - | Default: "utf-8" | Text encoding to use. | |
file - | Default: "ansible.ini" | Name of the file to load. | |
re boolean | Default: "no" | Flag to indicate if the key supplied is a regexp. | |
section - | Default: "global" | Section where to lookup the key. | |
type - |
| Type of the file. 'properties' refers to the Java properties files. |
- 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: - '.* section=section1 file=test.ini re=True'
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 |
Hint
If you notice any issues in this documentation, you can edit this document to improve it.
Hint
Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/plugins/lookup/ini.html