ansible 1.6.10

- name: Get vmail home directory
  shell: "/bin/grep vmail /etc/passwd | cut -d':' -f6"
  register: vmail_dir

- name: Modify postfix config
  lineinfile: dest=/etc/postfix/main.cf
              line="{{item}}"
              insertafter='^mydestination\ =\ \$myhostname,\ 
localhost\.\$mydomain,\ localhost$'
  with_items:
    - "virtual_mailbox_maps = ldap:/etc/postfix/ldap-users.cf"
    - "virtual_mailbox_base = {{vmail_dir}}"
    - "virtual_mailbox_domains = $mydomain"


This fails like::

failed: [test] => (item=virtual_mailbox_base = {u'changed': True, u'end': 
u'2014-09-09 09:38:11.112576', u'stdout': u'/home/vmail', u'cmd': 
u"/bin/grep vmail /etc/passwd | cut -d':' -f6", u'rc': 0, u'start': 
u'2014-09-09 09:38:11.109507', u'stderr': u'', u'delta': u'0:00:00.003069', 
'invocation': {'module_name': 'shell', 'module_args': "/bin/grep vmail 
/etc/passwd | cut -d':' -f6"}, 'stdout_lines': [u'/home/vmail']}) => 
{"failed": true, "item": "virtual_mailbox_base = {u'changed': True, u'end': 
u'2014-09-09 09:38:11.112576', u'stdout': u'/home/vmail', u'cmd': 
u\"/bin/grep vmail /etc/passwd | cut -d':' -f6\", u'rc': 0, u'start': 
u'2014-09-09 09:38:11.109507', u'stderr': u'', u'delta': u'0:00:00.003069', 
'invocation': {'module_name': 'shell', 'module_args': \"/bin/grep vmail 
/etc/passwd | cut -d':' -f6\"}, 'stdout_lines': [u'/home/vmail']}"}
msg: this module requires key=value arguments 
(['dest=/etc/postfix/main.cf', "line=virtual_mailbox_base = {u'changed': 
True, u'end': u'2014-09-09 09:38:11.112576', u'stdout': u'/home/vmail', 
u'cmd': u/bin/grep", 'vmail', '/etc/passwd', '|', 'cut', '-d:', "-f6, 
u'rc': 0, u'start': u'2014-09-09 09:38:11.109507', u'stderr': u'', 
u'delta': u'0:00:00.003069', 'invocation': {'module_name': 'shell', 
'module_args': /bin/grep", 'vmail', '/etc/passwd', '|', 'cut', '-d:', 
"-f6}, 'stdout_lines': [u'/home/vmail']}", 'insertafter=^mydestination\\ 
=\\ \\$myhostname,\\ localhost\\.\\$mydomain,\\ localhost$'])


It looks like I'm just not getting the quoting right.  I tried enquoting 
the line with strong quotes and the variable with double quotes.

-- 
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/f843a54d-19e1-479b-8d39-afb65b6679ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to