Thanks kai ! setting become: false worked. -VM
On Fri, Jul 28, 2017 at 6:42 AM, Kai Stian Olstad < [email protected]> wrote: > 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 a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit https://groups.google.com/d/to > pic/ansible-project/w9XT01E6i6Q/unsubscribe. > To unsubscribe from this group and all its topics, 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/ms > gid/ansible-project/03c60156148a083a08ccde6afdca9646%40olstad.com. > > For more options, visit https://groups.google.com/d/optout. > -- 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/CAKcuOAzkSXcuxW18dUTSL4A9cF6hLPn53Uoa%3Dj52-yWakpQjUw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
