- name: Check if ssh key exists
stat: path= "/config/clients/ssh_keys/daniel_nanboe.pub"
register: exista
- debug: var=exista
- fail:
msg: Stop
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 <nan...@gmail.com> 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 ansible...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/876f3fed-4bdb-4982-8946-4d44c4ae2b28%40googlegroups.com.
- name: Check if ssh key exists
local_action: stat path="/config/clients/ssh_keys/daniel_nanboe.pub"