# How ansible handle ini config file

**URL:** <https://forum.ansible.com/t/how-ansible-handle-ini-config-file/21606>\
**Category:** Ansible Project\
**Created:** [May 30, 2016, 1:32pm UTC](https://forum.ansible.com/t/how-ansible-handle-ini-config-file/21606 "2016-05-30T13:32:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gang\_Xu](https://avatars.discourse-cdn.com/v4/letter/g/ecb155/32.png) [@Gang\_Xu](https://forum.ansible.com/u/Gang_Xu)\
**Post date:** [May 30, 2016, 1:32pm UTC](https://forum.ansible.com/t/how-ansible-handle-ini-config-file/21606/1 "2016-05-30T13:32:45Z")

</div>

I have many ini format config files, below is template

[DEFAULT]  
bbb=bbbbb

[CONNECTION]  
ddd=ddddd

I have below ansible playbooks segment

name: Setup ini config file  
ini\_file: dest=/etc/test.conf section={{ item.0 }} option={{ item.1 }} value={{ item.2 }}  
with\_nested:  
– ['DEFAULT], ‘aaa’, ‘aaaaaa’ ]  
– [‘CONNECTION’, ‘ccc’, ‘ccccccccccc’]

But after running, the final files are not my expectation.

I want my file to be  
[DEFAULT]  
bbb=bbbbb  
aaa=aaaaaa

[CONNECTION]  
ddd=ddddd  
ccc=ccccccc

Could anyone tell me how to do?

Thanks in advance!

BTW, seemed with\_items also not work.

My ansible is 2.0.1.0 and running on CentOS 7

BRs/Xu Gang
