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.
On Thu, May 21, 2015 at 10:34 AM, Torsten Reinhard <[email protected]> wrote: > 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: > > --- > # > # JDK > # > - debug: var=ansible_user_id > > - name: Assures {{jdk_root}} dir exists > file: path={{jdk_root}} state=directory > ... > > > > When I run this playbook using the command: > > ansible-playbook -i /path/to/hosts test-jdk.yml -v > > I receive the following output: > > PLAY [Test playbook for roles/jdk] > ******************************************** > > GATHERING FACTS > *************************************************************** > ok: [localhost] > > TASK: [jdk | debug var=ansible_user_id] > *************************************** > ok: [localhost] => { > "ansible_user_id": "vagrant" > } > ... > > > => Why is the User "vagrant" used here, although I set user: root in the > playbook ? > > A task that tries to chown fails afterwards. > > Whenever I define a [group_name] in my hosts file configured to localhost > (192.168.....) it all works fine. > > > Thanx for any explanation, > > Torsten > sdfs > > ssdf > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/1a5187cb-2c29-4fbb-b013-aead2734b767%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8%3Dvnixh8V9SZrdbnhLEYgRmHPvt_a%2BdatdLe7THefvH4A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
