Checking the presence of some CA certificate on a remote Linux host

Hello guys,

I need to download & install the CA certificate only if it is not present on the remote host.

Does anyone know how to achieve the CA certificate presence check with Ansible?

That will be used to populate a variable used for something along those lines:

`

  • name: Downloading the CA certificate from the official site
    get_url: url={{ ca_url }} dest={{ dest_cert_folder }} use_proxy=no

when: ca_cert == ‘absent’
`

Drop the when: line and it will work.
Because dest= is a folder in your code the file will be downloaded every time but only replaced if it differ.
If you do not want to download the file every time make dest= a file.

This role might be helpful: https://github.com/Oefenweb/ansible-ca-certificates