# How do I use a symbolic user for a remote ansible task?

**URL:** <https://forum.ansible.com/t/how-do-i-use-a-symbolic-user-for-a-remote-ansible-task/21797>\
**Category:** Ansible Project\
**Created:** [June 16, 2016, 10:02pm UTC](https://forum.ansible.com/t/how-do-i-use-a-symbolic-user-for-a-remote-ansible-task/21797 "2016-06-16T22:02:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_Daley](https://avatars.discourse-cdn.com/v4/letter/t/3da27b/32.png) [@Tim\_Daley](https://forum.ansible.com/u/Tim_Daley)\
**Post date:** [June 16, 2016, 10:02pm UTC](https://forum.ansible.com/t/how-do-i-use-a-symbolic-user-for-a-remote-ansible-task/21797/1 "2016-06-16T22:02:02Z")

</div>

I have the following snippet from my playbook. The hosts: substitutes just fine, but the user: gives "SSH Error: command-line line0: garbage at end of line; “{{ username }}”. Is substitution of the user possible?

`  
Enter code here…

- Other stuff  
`

```auto
   - set_fact: username="user"

- name: gather facts
  hosts: "{{ aws_host_group }}"
  connections: ssh
  user: "{{ username }}"
  become: true
  vars:
    - aws_host_group: "{{ aws_type + 'hosts' }}"
  pre_tasks:
    - name: Yum Update
      yum: name='*' state=latest

```

if I delete the register and add the following to my vars: - username: user

The message changes to "SSH Error: command-line line0: garbage at end of line; “user”.

This shows that there is at least partial substitution happening.

---

<div class="post-metadata">

**Author:** ![Tim\_Daley](https://avatars.discourse-cdn.com/v4/letter/t/3da27b/32.png) [@Tim\_Daley](https://forum.ansible.com/u/Tim_Daley)\
**Post date:** [June 20, 2016, 8:30pm UTC](https://forum.ansible.com/t/how-do-i-use-a-symbolic-user-for-a-remote-ansible-task/21797/2 "2016-06-20T20:30:00Z")

</div>

if remote\_user: is used rather than user: the substitutions seem to work.
