bug on sudo_user parametrization ?

Hello,

I have a simplified task like so on the current devel branch :

  • name: create sites directory
    file: path=/home/{{ item }}/sites state=directory
    sudo: yes
    sudo_user: “prefix{{ item }}suffix”
    with_items:
  • user1
  • user2

I get the error :
invalid output was: sudo: unknown user: prefixsuffix

so the templating seems to be done, but without the correct value for {{ item }}.

Am I missing something ?

Thank you

This seems like a question more appropriate for ansible-users, but the basic scenario is that sudo_user on the task is pretty new and I don’t think we anticipated this being used with with_items.

Please file a bug and we can look into it.

–Michael

ticket created on
https://github.com/ansible/ansible/issues/4411

For info I added a proposed pr on https://github.com/ansible/ansible/issues/4411
I hope I got the sudo_user flow right.