I have a problem when using the ini_file module as follows:

---
- 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' }

Will produce the following results:

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.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a78a57a1-6f90-49b6-903d-552f7084d2ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to