# user: root ignored when running on hosts:localhost ?

**URL:** <https://forum.ansible.com/t/user-root-ignored-when-running-on-hosts-localhost/18281>\
**Category:** Ansible Project\
**Created:** [May 21, 2015, 2:34pm UTC](https://forum.ansible.com/t/user-root-ignored-when-running-on-hosts-localhost/18281 "2015-05-21T14:34:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Torsten\_Reinhard](https://avatars.discourse-cdn.com/v4/letter/t/46a35a/32.png) [@Torsten\_Reinhard](https://forum.ansible.com/u/Torsten_Reinhard)\
**Post date:** [May 21, 2015, 2:34pm UTC](https://forum.ansible.com/t/user-root-ignored-when-running-on-hosts-localhost/18281/1 "2015-05-21T14:34:35Z")

</div>

Hi,

I´m using Ansible 1.8.2 running on Virtualbox (CentOs6.5) with this small playbook:

`

- name: Test playbook for roles/jdk  
hosts: localhost  
user: root

vars:  
jdk\_root: /tmp/opt/java

roles:

- { role: jdk, jdk\_version: “1.8.0\_40” }

`

The role looks like:

`

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [May 21, 2015, 4:59pm UTC](https://forum.ansible.com/t/user-root-ignored-when-running-on-hosts-localhost/18281/2 "2015-05-21T16:59:34Z")

</div>

remote\_user( which is what the deprecated 'user' sets) is ignored on  
connection: local as there is no 'remote login', you can either force  
to ssh to localhost as root with connection: ssh or you can use  
become: true to use sudo to become root locally.
