This plugin provides a lookup plugin to ini sections
ansible >= 2.0
test.ini
# test section 1
[section1]
one=1
two=2
three=3
# test section 2
[section2]
a=b
ccc=ddd
playbook
- name: My test Play
hosts: all
roles:
- heriet.lookup_ini_sections
tasks
- debug: msg="{{ lookup('ini_sections', file='test.ini') }}"
ansible-playbook -i tests/inventory test.yml
ok: [localhost] => {
"msg": [
{
"name": "section1",
"params": {
"one": "1",
"three": "3",
"two": "2"
}
},
{
"name": "section2",
"params": {
"a": "b",
"ccc": "ddd"
}
}
]
}
Apache License 2.0