On 28.07.2017 01:06, Vijay Misra wrote:
One more thing i wanted to clarify nomatter what command i se for appending
the line( command/sheel/lineinfile) it always fails and outpus sudo; A
password is required.
am i missing something>

You have become: true in your play, so you need to provide a password if do not have passwordless sudo.
become: true on the play means all task will runs with become.

Do esx have sudo?
My installation do not have sudo.

Since your delegate_to: run on a different host it will a problem if the remote host and the localhost does not have the same password. But in you case the lineinfile does not need sudo i guess so you can set become: false on that task.


- hosts: esx1
  become: true
  roles:
     - ESX_VM_SnapRestore


**********************************************

- lineinfile:
    path: /etc/ansible/results.txt
    line: 'HPQC Passed Create snapshot of a vGPU VM on ESX'
    insertafter: EOF
  when: taskresult|succeeded
  delegate_to: localhost

By the way, when you use lineinfile it will not append to EOF if the text in line: already exist somewhere in the file.

--
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/03c60156148a083a08ccde6afdca9646%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to