Have a self-written
letsencrypt role (see the Prometheus: RTFM blog monitoring set up with Ansible – Grafana, Loki, and promtail post).
Before running the Let’s Encrypt client to obtain a new certificate – need to check if NGINX is installed on a remote host.
Let’s use the
... - name: "Check if NGINX is installed" package_facts: manager: "auto" ...
And add a conditional check with
when using the
... - name: "NGINX test result" debug: msg: "NGINX found" when: "'nginx' in ansible_facts.packages" - name: "NGINX test result" debug: msg: "NGINX NOT found" when: "'nginx' not in ansible_facts.packages"