How ansible handle ini config file

18 views
Skip to first unread message

Gang Xu

unread,
May 31, 2016, 8:12:52 AM5/31/16
to Ansible Project

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

Reply all
Reply to author
Forward
0 new messages