---
- name: Test 'ini_file'
hosts: mediaserver
user: root
tasks:
- name: Create 'config.ini' to include necessary values
ini_file:
dest=/root/testconfig.ini
section={{ item.section }}
option={{ item.option }}
value={{ item.value }}
with_items:
- { section: 'General', option: 'test1', value: 'value2' }
- { section: 'General2', option: 'test2', value: 2 }
- { section: 'General3', option: 'test3', value: 'This is a test' }
root@ansibleControl:~# ansible-playbook test.yml
PLAY [Test 'ini_file'] ********************************************************
GATHERING FACTS ***************************************************************
ok: [192.168.154.243]
TASK: [Create 'config.ini' to include necessary values] ***********************
changed: [192.168.154.243] => (item={'section': 'General', 'option': 'test1', 'value': 'value2'})
changed: [192.168.154.243] => (item={'section': 'General2', 'option': 'test2', 'value': 2})
failed: [192.168.154.243] => (item={'section': 'General3', 'option': 'test3', 'value': 'This is a test'}) => {"failed": true, "item": {"option": "test3", "section": "General3", "value": "This is a test"}}
msg: this module requires key=value arguments (['dest=/root/testconfig.ini', 'section=General3', 'option=test3', 'value=This', 'is', 'a', 'test'])
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/root/test.retry
192.168.154.243 : ok=1 changed=0 unreachable=0 failed=1
It appears that the 'value', even though it is wrapped in quotes, is being treated as a list.
I am wondering if this is a bug.