I always set ansible user in the inventory file.

I actually narrowed down the issue. It happens whenever a new host is added
in a screen session. So, when working with already known hosts or when
screen isn't used, I don't see it.


On Fri, Aug 15, 2014 at 6:17 AM, Steffen Prince <[email protected]> wrote:

> Sorry for bumping this old thread, but I encountered "previous known host
> file not found" myself and identified my problem.
>
> I was using ansible on a host where my login name did not match the name I
> wanted to run ansible under, so I set $USER to the desired name. This is a
> bad idea generally, but with Ansible will cause the following to fail:
>
>     os.path.expanduser(os.path.expandvars("~${USER}/.ssh/known_hosts"))
>
> So the correct way to use another name for Ansible ssh is to use the "-u"
> flag to ansible-playbook. Check to be sure $USER is actually set to your
> local username if you see this issue.
>
> On Thursday, February 13, 2014 1:52:14 PM UTC-8, Ilya Ivanov wrote:
>
>> Ok thanks I'll try that.
>>
>>
>> On Fri, Feb 14, 2014 at 4:49 AM, Jesse Keating <[email protected]>
>> wrote:
>>
>>> I would edit the source code and put a debugger statement inside the if
>>> statement that does the print. This way when running ansible if you happen
>>> to get into this state, you can examine the various data, like what it
>>> thinks the value of host_file is, and then compare that to your filesystem.
>>>
>>>
>>> On 2/13/14, 1:47 PM, Ilya Ivanov wrote:
>>>
>>>> But the file exists (and the host is there). What could I do to debug it
>>>> further?
>>>>
>>>>
>>>> On Fri, Feb 14, 2014 at 4:29 AM, Jesse Keating <[email protected]
>>>> <mailto:[email protected]>> wrote:
>>>>
>>>>     On 2/13/14, 12:37 PM, Ilya Ivanov wrote:
>>>>
>>>>         "previous known host file not found" is an Ansible message. Does
>>>>         anyone
>>>>         know the conditions under which is it triggered?
>>>>
>>>>
>>>>     Grepping the code shows it pretty clearly:
>>>>
>>>>          def not_in_host_file(self, host):
>>>>              host_file =
>>>>     os.path.expanduser(os.path.__expandvars("~${USER}/.ssh/__kno
>>>> wn_hosts"))
>>>>
>>>>              if not os.path.exists(host_file):
>>>>                  print "previous known host file not found"
>>>>
>>>>     This is called when a command is executed.
>>>>
>>>>     It looks to your user's homedir/.ssh/known_hosts and if that file
>>>>     doesn't exist, it prints that message you're seeing.
>>>>
>>>>     Use of straight ssh will read various config files to determine
>>>>     where the known_hosts file is, such as /etc/ssh/ssh_config and
>>>>     ~/.ssh/config
>>>>
>>>>     Perhaps in one of those there is a configuration that marks
>>>>     known_hosts as some other file -- or you have a setting that is
>>>>     preventing ssh from every even checking for known hosts. Either way,
>>>>     that's where the message comes from.
>>>>
>>>>
>>>>     -jlk
>>>>
>>>>
>>>>     --
>>>>     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/h-__EWBy
>>>> IPDuY/unsubscribe
>>>>     <https://groups.google.com/d/topic/ansible-project/h-EWByIPD
>>>> uY/unsubscribe>.
>>>>
>>>>     To unsubscribe from this group and all its topics, send an email to
>>>>     ansible-project+unsubscribe@__googlegroups.com
>>>>     <mailto:ansible-project%[email protected]>.
>>>>
>>>>     To post to this group, send email to
>>>>     ansible-project@googlegroups.__com
>>>>     <mailto:[email protected]>.
>>>>
>>>>     For more options, visit https://groups.google.com/__groups/opt_out
>>>>     <https://groups.google.com/groups/opt_out>.
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Ilya.
>>>>
>>>> --
>>>> 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].
>>>>
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>
>>>
>>>
>>> -jlk
>>>
>>> --
>>> 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/h-EWByIPDuY/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].
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> --
>> Ilya.
>>
>  --
> 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/h-EWByIPDuY/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/4b3d7654-5bba-4a74-964d-81944ae2e861%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/4b3d7654-5bba-4a74-964d-81944ae2e861%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Ilya.

-- 
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/CAA%3DKoeKPkMfvFyzMutqnNvqGRUbST%2BnDWWWbF_SAEwtremFQZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to