If the ssh-agent must be running for your installer to complete, then
you'll probably have to run it after the ssh-add:

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

My gut feeling is that there's something missing that would make your task
a lot easier and not need the ssh-agent/ssh-add processes.

On Sun, Sep 30, 2018 at 5:47 PM pranay varankar <[email protected]>
wrote:

> Hi Dan,
>
> Actually we install some of my on-premises software on remote machine but
> we required ssh-agent configured on that remote machine to install this
> software.
>
> without authenticate with that keys we can not able to install this
> software on my remote machine.
>
> is their any way to check the below task was running properly on my remote
> machine.
>
> - name: Add and load private key to ssh-agent
>   shell: "eval `ssh-agent -s` && ssh-add ~/.ssh/id_rsa"
>
> On Mon, Oct 1, 2018 at 2:26 AM Dan Linder <[email protected]> wrote:
>
>> Hi Pranay,
>>
>> You asked, is "task i wrote in playbook in correct or not ?"
>>
>> Based on the output from your playbook provided earlier, the
>> tasks/commands ("ssh-agent" and "ssh-add") ARE being executed on the remote
>> machine without error - the yellow "changed:" response notes that the
>> "shell:" module ran and the two commands did not return an error.
>>
>> Back to the question we asked earlier, what are you trying to get setup
>> by running these steps?
>>
>> Until you can tell us what you're trying to do exactly by running these
>> commands, we can't really help you further.  You've setup the "shell:"
>> module properly and the commands run without error.  Until we know what
>> you're trying to do later we can't provide any further assistance.
>>
>> On Sunday, September 30, 2018 at 2:25:38 PM UTC-5, pranay varankar wrote:
>>>
>>> Hi Dan,
>>>
>>> Thanks for providing information.
>>>
>>> Actually, I have already add key file to client machine.
>>>
>>> I have a question ...The task i wrote in playbook in correct or not ? if
>>> it wrong can you send me the correct task to perform those command on
>>> client machine.
>>>
>>> - name: Add and load private key to ssh-agent
>>>   shell: "eval `ssh-agent -s` && ssh-add ~/.ssh/id_rsa"
>>>
>>>
>>>
>>> On Sun, Sep 30, 2018 at 11:45 PM Dan Linder <[email protected]> wrote:
>>>
>>>> The "ssh-agent" and "ssh-add" are usually run on a system as a specific
>>>> user to add an SSH key to a temporary 'keychain' so any subsequent SSH
>>>> commands can automatically (and without prompting) use a specific ssh key
>>>> to connect to a second system.
>>>>
>>>> When you run them in the Ansible "shell" module, it's running those on
>>>> the remote system and once that module completes, the ssh keychain process
>>>> ("ssh-agent") is closed and it goes away.
>>>>
>>>> As  Johnathan asked, what are you trying to get setup by running these
>>>> steps?  It looks like you're trying to get it setup so you can SSH into the
>>>> "ubuntu-target" system as root using the "id_rsa" key on "ubuntu" .  (But
>>>> since your ansible-playbook command doesn't prompt for credentials, it
>>>> appears you already have the shared ssh key setup, so I'm confused what
>>>> larger problem you're trying to solve...)
>>>>
>>>> On Sunday, September 30, 2018 at 5:52:41 AM UTC-5, pranay varankar
>>>> wrote:
>>>>>
>>>>> 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 <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> what exactly are you trying to accomplish?
>>>>>>
>>>>>> On Sat, Sep 29, 2018 at 6:03 PM pranay varankar <[email protected]>
>>>>>> 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, <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> try
>>>>>>>>
>>>>>>>> ssh-agent bash
>>>>>>>>
>>>>>>>> then
>>>>>>>>
>>>>>>>> ssh-add
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sat, Sep 29, 2018 at 5:04 PM pranay varankar <
>>>>>>>> [email protected]> 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 <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> what error are you getting ?
>>>>>>>>>>
>>>>>>>>>> On Sat, Sep 29, 2018 at 7:05 AM pranay varankar <
>>>>>>>>>> [email protected]> 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 [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/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 [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/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 [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/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 [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/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 [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/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 [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/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 [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/3c34106c-fb10-4ce1-acb4-1dcd8aaf680b%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/ansible-project/3c34106c-fb10-4ce1-acb4-1dcd8aaf680b%40googlegroups.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 [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/f26029a0-af6a-4209-b246-ad8ee58dd450%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/f26029a0-af6a-4209-b246-ad8ee58dd450%40googlegroups.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 a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/PrRiiQHS7mM/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/msgid/ansible-project/CAKmxsS1pSVJN6b8efB3A-33gYThQCmGv9QskorrRg6nVk2S%3DQg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAKmxsS1pSVJN6b8efB3A-33gYThQCmGv9QskorrRg6nVk2S%3DQg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
***************** ************* *********** ******* ***** *** **
"If you wish to make an apple pie from scratch,
  you must first invent the universe."
  -- Carl Sagan

"Quis custodiet ipsos custodes?"
    (Who can watch the watchmen?)
    -- from the Satires of Juvenal

"I do not fear computers, I fear the lack of them."
    -- Isaac Asimov (Author)
** *** ***** ******* *********** ************* *****************

-- 
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/CAGYusaNpUW4JJGedY9z9CXChijDF5-Swfp78BADtU8cbPQKM8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to