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

170 views
Skip to first unread message

Adrian Simmons

unread,
May 8, 2014, 5:12:14 PM5/8/14
to ansible...@googlegroups.com
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

Brian Coca

unread,
May 8, 2014, 5:25:21 PM5/8/14
to ansible...@googlegroups.com
try this:

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




--
Brian Coca
Stultorum infinitus est numerus
0110000101110010011001010110111000100111011101000010000001111001011011110111010100100000011100110110110101100001011100100111010000100001
Pedo mellon a minno

Adrian Simmons

unread,
May 9, 2014, 7:20:07 AM5/9/14
to ansible...@googlegroups.com
Spot on! Somehow I knew it was going to be a simple answer :/
Was also able to revert to single quotes on the value items in the list.

Thanks Brian.
Reply all
Reply to author
Forward
0 new messages