-4

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?

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

1 Answer 1

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 and acknowledge you have read our privacy policy.

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