-3

I am running an ansible task that will among others install a let's encrypt certificate.

I want the task to only run if the certificate has not been installed.

What is the best way to check (via cmd) if my host has a valid secure connection over https?

  • 1
    Certbot already ensure the certificate has to be renewed or not... why not let it handle that ? – Tensibai Mar 8 '18 at 12:35
  • What role do you use, e.g. github.com/030/ansible-certbot – 030 Mar 8 '18 at 17:47
  • Did the link help? If not, please post the code you have created. – 030 Mar 11 '18 at 17:51
1

One could use the apt module of Ansible. http://docs.ansible.com/ansible/latest/apt_module.html

The apt module uses apt and apt itself is able to check whether a package has already been installed and will prevent that it will be installed as it has already been installed.

I use this module myself as well. As the idempotence test passes it indicates that it will not install certbot if it has been installed already.

https://github.com/030/ansible-certbot/blob/master/tasks/Debian.yml#L10

- name: certbot installed
  apt:
    name: certbot
    state: latest

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.