# Using ansible\_user or remote\_user in group\_vars

**URL:** <https://forum.ansible.com/t/using-ansible-user-or-remote-user-in-group-vars/33919>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [September 29, 2020, 8:56am UTC](https://forum.ansible.com/t/using-ansible-user-or-remote-user-in-group-vars/33919 "2020-09-29T08:56:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Liddicott](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Simon\_Liddicott](https://forum.ansible.com/u/Simon_Liddicott)\
**Post date:** [September 29, 2020, 8:56am UTC](https://forum.ansible.com/t/using-ansible-user-or-remote-user-in-group-vars/33919/1 "2020-09-29T08:56:29Z")

</div>

Hi

I want to use ansible\_user in group\_vars so that I can set ansible\_winrm\_user to add a domain name for authentication.

EG.

ansible\_winrm\_user: “{{ ansible\_user }}@{{ windows\_domain}}”  
become\_user: “{{ ansible\_user }}@{{ windows\_domain}}”

I’d apply this to group\_vars for windows machines.

When I try it I get the following error:

The field ‘ansible\_winrm\_user’ has an invalid value, which includes an undefined variable. The error was: ‘ansible\_user’ is undefined",

I’ve also tried it with remote\_user to the same result.

It used to work ~2.1 but doesn’t on 2.9.

Is there a new way of doing this or is it a bug?

Thanks.

Si.
