feat: check if the port 80 is used

This commit is contained in:
Adrien Waksberg 2021-08-24 18:47:19 +02:00
parent b9e7adfe81
commit b00d571718
2 changed files with 10 additions and 6 deletions

View file

@ -14,6 +14,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
- test: replace kitchen to molecule
- chore: use FQCN for module name
- feat: check if the port 80 is used
### Removed

View file

@ -6,10 +6,13 @@
register: st
tags: certbot
- name: check if nginx is launch
ansible.builtin.stat:
path: /var/run/nginx.pid
register: ng
- name: check if a webservice is started on port 80
ansible.builtin.wait_for:
port: 80
state: started
timeout: 5
ignore_errors: true
register: web
tags: certbot
- name: create a new certificate
@ -17,7 +20,7 @@
certbot certonly -n --agree-tos -d {{ item.item.name }} -m {{ certbot_mail }}
--webroot --webroot-path {{ certbot_path }} --rsa-key-size {{ certbot_key_size }}
loop: '{{ st.results }}'
when: (certbot_role == 'master' or item.item.name == ansible_fqdn) and not item.stat.exists and ng.stat.exists
when: (certbot_role == 'master' or item.item.name == ansible_fqdn) and not item.stat.exists and not web.failed
tags: certbot
- name: create a new certificate (standalone)
@ -25,5 +28,5 @@
certbot certonly -n --agree-tos -d {{ item.item.name }} -m {{ certbot_mail }}
--standalone --rsa-key-size {{ certbot_key_size }}
loop: '{{ st.results }}'
when: (certbot_role == 'master' or item.item.name == ansible_fqdn) and not item.stat.exists and not ng.stat.exists
when: (certbot_role == 'master' or item.item.name == ansible_fqdn) and not item.stat.exists and web.failed
tags: certbot