Ansible become_user with variable

I think I found it:

become_user: "{{ansible_ssh_user}}"

In fact the remote_user: admin is another way of defining the variable ansible_ssh_user, I dont know why remote_user is not accessible as a variable, but what I know is that when you set remote_user, it changes the variable ansible_ssh_user

Not sure if it's a clean solution though, but it works


What about that:

- name: Foo
  hosts: foo
  vars:
    http_port: 80
    my_user: admin
  remote_user: "{{my_user}}"

then:

- name: Config git user name
  git_config: name=user.name scope=global value={{ ansible_host }}
  become: Yes
  become_user: "{{my_user}}"