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

22 views
Skip to first unread message

jean-christophe manciot

unread,
May 20, 2016, 9:25:42 AM5/20/16
to Ansible Project
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'

Kai Stian Olstad

unread,
May 20, 2016, 12:34:47 PM5/20/16
to ansible...@googlegroups.com
On 20. mai 2016 15:25, jean-christophe manciot wrote:
> 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.

--
Kai Stian Olstad

Mischa ter Smitten

unread,
May 20, 2016, 3:05:41 PM5/20/16
to Ansible Project
Reply all
Reply to author
Forward
0 new messages