Hi Jonathan,

I use below task in my playbook,

- name: Add and load private key to ssh-agent
  shell: "eval `ssh-agent -s` && ssh-add ~/.ssh/id_rsa"

When i run playbook no error found,

[image: image.png]

But I log in to my client machine and type "ssh-add -l" command then I get
below error

[image: image.png]


On Sun, Sep 30, 2018 at 5:11 AM Jonathan Lozada De La Matta <
jloza...@redhat.com> wrote:

> what exactly are you trying to accomplish?
>
> On Sat, Sep 29, 2018 at 6:03 PM pranay varankar <varankarpra...@gmail.com>
> wrote:
>
>> Hi Jonathan,
>>
>> But which module I use to run *eval `ssh-agent -s` or ssh-add
>> /root/bashrc.*
>>
>> *Shell/command/action/raw module to create task for above command*
>>
>>
>> On Sun 30 Sep, 2018, 2:53 AM Jonathan Lozada De La Matta, <
>> jloza...@redhat.com> wrote:
>>
>>> try
>>>
>>> ssh-agent bash
>>>
>>> then
>>>
>>> ssh-add
>>>
>>>
>>>
>>> On Sat, Sep 29, 2018 at 5:04 PM pranay varankar <
>>> varankarpra...@gmail.com> wrote:
>>>
>>>> Hi  Jonathan,
>>>>
>>>> actually i m not getting error when i run playbook but after i will
>>>> login to client machine and check using "ssh-add -l"  command then i get 
>>>> "Could
>>>> not open a connection to your authentication agent" error.
>>>>
>>>> Can you send me task code to perform this operation.
>>>>
>>>> On Sun, Sep 30, 2018 at 1:03 AM Jonathan Lozada De La Matta <
>>>> jloza...@redhat.com> wrote:
>>>>
>>>>> what error are you getting ?
>>>>>
>>>>> On Sat, Sep 29, 2018 at 7:05 AM pranay varankar <
>>>>> varankarpra...@gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I need to add ssh-agent for root user. so I use below command through
>>>>>> ansible task but getting an error.
>>>>>>
>>>>>> *eval `ssh-agent -s` && ssh-add ~/.ssh/id_rsa"*
>>>>>>
>>>>>> please give me task to perform below command on my target machine.
>>>>>>
>>>>>> --
>>>>>> 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 ansible-project+unsubscr...@googlegroups.com.
>>>>>> To post to this group, send email to ansible-project@googlegroups.com
>>>>>> .
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/ansible-project/fe7af62c-fb24-4d95-8acc-0078e45a955f%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/ansible-project/fe7af62c-fb24-4d95-8acc-0078e45a955f%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Jonathan lozada de la matta
>>>>>
>>>>> AUTOMATION PRACTICE
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>>
>>>>> --
>>>>> 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 ansible-project+unsubscr...@googlegroups.com.
>>>>> To post to this group, send email to ansible-project@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BLD%2B8KUCGC7FtudXbp%3DQ_yKt0rOjwNAC70_n3diOw8iGw%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BLD%2B8KUCGC7FtudXbp%3DQ_yKt0rOjwNAC70_n3diOw8iGw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> 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 ansible-project+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to ansible-project@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/ansible-project/CAKmxsS0fs%2Bn_dNoT3GA21kTo8NbJMNPDpv%2ByVKs_ms_KBn_Xnw%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/ansible-project/CAKmxsS0fs%2Bn_dNoT3GA21kTo8NbJMNPDpv%2ByVKs_ms_KBn_Xnw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>>
>>> Jonathan lozada de la matta
>>>
>>> AUTOMATION PRACTICE
>>>
>>>
>>>
>>>
>>> --
>>> 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 ansible-project+unsubscr...@googlegroups.com.
>>> To post to this group, send email to ansible-project@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BJbAn7BdoB3935KPtjazQmHYQ0CAN59tJVME07tN69-3A%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BJbAn7BdoB3935KPtjazQmHYQ0CAN59tJVME07tN69-3A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> 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 ansible-project+unsubscr...@googlegroups.com.
>> To post to this group, send email to ansible-project@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAKmxsS39KwVP4SFWpQDFH3N%3DDpR5V-YDSk%3DOJqMq-Te0Yrf4%2BA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAKmxsS39KwVP4SFWpQDFH3N%3DDpR5V-YDSk%3DOJqMq-Te0Yrf4%2BA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
>
> Jonathan lozada de la matta
>
> AUTOMATION PRACTICE
>
>
>
>
> --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAFYJA%2B%2Bp%3Dt3EB66O_3WQM7MDTrYNseixsxH_xKM_Zv%2BP%3Dwud_g%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAFYJA%2B%2Bp%3Dt3EB66O_3WQM7MDTrYNseixsxH_xKM_Zv%2BP%3Dwud_g%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> 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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAKmxsS3z9hX%2BUALbV_S8sfTMmzcK_6RE97GPBW4KWJ9qVuWpTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to