Problem with a debconf key=value when value has a space

I’ve been trying the new debconf module with Postfix on ubuntu 14.04.

Here’s the problem section of the roles task file:

`

  • name: Postfix | Set debconf values
    debconf: name=postfix question={{ item.question }} value={{ item.value }} vtype={{ item.vtype }}
    with_items:
  • { question: ‘postfix/main_mailer_type’, value: “Internet Site”, vtype: ‘select’ }
  • { question: ‘postfix/mailname’ , value: “{{ fqdn }}” , vtype: ‘string’ }
  • { question: ‘postfix/relayhost’ , value: “$mydomain” , vtype: ‘string’ }
  • { question: ‘postfix/protocols’ , value: “loopback-only”, vtype: ‘string’ }
  • { question: ‘postfix/destinations’ , value: “” , vtype: ‘string’ }

`

The first line causes the following error:

`

failed: [hostname] => (item={‘vtype’: ‘string’, ‘question’: ‘postfix/main_mailer_type’, ‘value’: ‘Internet Site’}) => {“failed”: true, “item”: {“question”: “postfix/main_mailer_type”, “value”: “Internet Site”, “vtype”: “select”}}

msg: this module requires key=value arguments ([‘name=postfix’, ‘question=postfix/main_mailer_type’, ‘value=Internet’, ‘Site’, ‘vtype=string’])

`

So despite the fact that the failed value in the error message is seen as ‘Internet Site’ ansible debconf appears to treat that space as something meaningful instead of part of the string.

Am I doing something dumb with quoting in my code or is this likely to be a bug in debconf module?

(Also starting to think in terms of configuring Postfix with templates like everyone else…)

TIA

try this:

debconf: name=postfix question={{ item.question }} value="{{ item.value }}"
vtype={{ item.vtype }}

Spot on! Somehow I knew it was going to be a simple answer :confused:
Was also able to revert to single quotes on the value items in the list.

Thanks Brian.