It could still be a permissions issue, for instance if the ansible user has
different rights than whatever you did manually that caused you to believe
that the file is there.

On Tue, 4 Feb 2020 at 18:27, Daniel Nanboe <[email protected]> wrote:

> Thanks I have removed that but the result is the same when I debug de var
> stat is false:
>
> ok:  => {
>     "exista": {
>         "changed": false,
>         "failed": false,
>         "stat": {
>             "exists": false
>         }
>     }
> }
>
> On Tuesday, February 4, 2020 at 1:02:50 PM UTC+2, Dick Visser wrote:
>>
>> that exact task errors because of the space after "path=" - I think
>> that's a typo on your part?
>>
>>
>>
>> On Tue, 4 Feb 2020 at 11:52, Daniel Nanboe <[email protected]> wrote:
>> >
>> > I have a problem checking if a file exists:
>> >
>> > - name: Check if ssh key exists
>> >   stat: path= "/config/clients/ssh_keys/daniel_nanboe.pub"
>> >   register: exista
>> > - debug: var=exista
>> > - fail:
>> >     msg: Stop
>> >
>> >
>> >
>> > The file exists but the stat returns false:
>> >
>> > "exista": {
>> >         "changed": false,
>> >         "failed": false,
>> >         "stat": {
>> >             "exists": false
>> >         }
>> >     }
>> >
>> > --
>> > 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/72841c12-fda7-4df3-bc78-2997857a684f%40googlegroups.com.
>>
>>
>>
>>
>> --
>> Dick Visser
>> Trust & Identity Service Operations Manager
>> GÉANT
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/876f3fed-4bdb-4982-8946-4d44c4ae2b28%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/876f3fed-4bdb-4982-8946-4d44c4ae2b28%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwN4%3D-EwewRWjzGEia8MfK%2Bnx8ULNYooFSnkxB_t%3D%3DVTkg%40mail.gmail.com.

Reply via email to