On 02. aug. 2017 00:23, Vijay Misra wrote:
[localhost]
127.0.0.1  ansible_connection=local ansible_ssh_user=XXXX 
ansible_ssh_pass=XXXXXX

ansible_ssh_user is my ubuntu machine user( Question: Do I  necessarily need to 
give the user and password here?)

This is not correct, localhost is not a group.
Default Ansible sets "localhost ansible_connection=local" so you do not need this set in your inventory.

Since ansible_connection=local and not ssh you don't need to set ansible_ssh_user/pass since it will not be using ssh, it will run the command directly on the localhost in the current shell.


And since it shows permission issue, I include become: yes in the role as below

- hosts: localhost
   become: yes
   roles:
    - Local_File

then i get the following error:
vmisra@ubuntu:/etc/ansible$ ansible-playbook   vcenter_snaprestore.yml
[WARNING]: log file at /var/log/ansible.log is not writeable and we cannot 
create it, aborting


PLAY [localhost] 
********************************************************************************************************************************************************

TASK [Gathering Facts] 
**************************************************************************************************************************************************
fatal: [127.0.0.1]: FAILED! => {"changed": false, "failed": true, "module_stderr": "sudo: a password is required\n", 
"module_stdout": "", "msg": "MODULE FAILURE", "rc":

I am confused and this looks prety trivial thing but not sur to me what i am 
missing?

As the error message say "sudo: a password is required", since you can't run sudo without specifying a password you need to provide the sudo password to Ansible.

To do that add -K or --ask-become-pass on the command line

ansible-playbook -K vcenter_snaprestore.yml

--
Kai Stian Olstad

--
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/792f40eb-586a-fec0-011b-eacce9b333ea%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to