.. _ini_file: ini_file `````````````````````````````` .. versionadded:: 0.9 Manage (add, remove, change) individual settings in an INI-style file without having to manage the file as a whole with, say, ``template`` or ``assemble``. Adds missing sections if they don't exist. .. raw:: html
parameter | required | default | choices | comments |
---|---|---|---|---|
option | no | if set (required for changing a value), this is the name of the option.May be omitted if adding/removing a whole section. | ||
others | no | all arguments accepted by the file module also work here | ||
dest | yes | Path to the INI-style file; this file is created if required | ||
section | yes | Section name in INI file. This is added if state=present automatically when a single value is being set. |
||
backup | no |
|
Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. | |
value | no | the string value to be associated with an option. May be omitted when removing an option. |
Ensure fav=lemonade
is in section [drinks]
in said file
ini_file dest=/etc/conf section=drinks option=fav value=lemonade mode=0600 backup=true
ini_file dest=/etc/anotherconf section=drinks option=temperature value=cold backup=true
While it is possible to add an option without specifying a value, this makes no sense.