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

**URL:** <https://forum.ansible.com/t/checking-the-presence-of-some-ca-certificate-on-a-remote-linux-host/21506>\
**Category:** Ansible Project\
**Created:** [May 20, 2016, 1:25pm UTC](https://forum.ansible.com/t/checking-the-presence-of-some-ca-certificate-on-a-remote-linux-host/21506 "2016-05-20T13:25:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![actionmystique](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/actionmystique/32/1678_2.png) [@actionmystique](https://forum.ansible.com/u/actionmystique)\
**Post date:** [May 20, 2016, 1:25pm UTC](https://forum.ansible.com/t/checking-the-presence-of-some-ca-certificate-on-a-remote-linux-host/21506/1 "2016-05-20T13:25:42Z")

</div>

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’  
`

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [May 20, 2016, 4:34pm UTC](https://forum.ansible.com/t/checking-the-presence-of-some-ca-certificate-on-a-remote-linux-host/21506/2 "2016-05-20T16:34:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mischa\_ter\_Smitten](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@Mischa\_ter\_Smitten](https://forum.ansible.com/u/Mischa_ter_Smitten)\
**Post date:** [May 20, 2016, 7:05pm UTC](https://forum.ansible.com/t/checking-the-presence-of-some-ca-certificate-on-a-remote-linux-host/21506/3 "2016-05-20T19:05:41Z")

</div>

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