add opt out for ssl
This commit is contained in:
parent
751a0aebec
commit
d268d44421
3 changed files with 13 additions and 7 deletions
|
@ -1,4 +1,8 @@
|
||||||
---
|
---
|
||||||
|
ssl: true
|
||||||
|
ssl_port: 443
|
||||||
|
web_port: 80
|
||||||
|
apache_modules: []
|
||||||
vhosts: []
|
vhosts: []
|
||||||
# - vhostname: default.host.example.org
|
# - vhostname: default.host.example.org
|
||||||
# weight: 25
|
# weight: 25
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
- name: Allow HTTP traffic
|
- name: Allow HTTP traffic
|
||||||
ufw:
|
ufw:
|
||||||
rule: allow
|
rule: allow
|
||||||
port: 80
|
port: "{{ web_port }}"
|
||||||
|
|
||||||
- name: Allow HTTPS traffic
|
- name: Allow HTTPS traffic
|
||||||
ufw:
|
ufw:
|
||||||
rule: allow
|
rule: allow
|
||||||
port: 443
|
port: "{{ ssl_port | default(443) }}"
|
||||||
|
when: ssl
|
||||||
|
|
||||||
- name: Ensure MPM Worker module is disabled
|
- name: Ensure MPM Worker module is disabled
|
||||||
shell: a2dismod mpm_worker
|
shell: a2dismod mpm_worker
|
||||||
|
@ -60,7 +61,7 @@
|
||||||
state: present
|
state: present
|
||||||
force: True
|
force: True
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
with_items: "{{ apache_modules }}"
|
loop: "{{ apache_modules }}"
|
||||||
register: enabled_mods
|
register: enabled_mods
|
||||||
when: apache_modules is defined
|
when: apache_modules is defined
|
||||||
|
|
||||||
|
@ -99,6 +100,3 @@
|
||||||
with_items: "{{ vhosts }}"
|
with_items: "{{ vhosts }}"
|
||||||
notify:
|
notify:
|
||||||
- Restart Apache
|
- Restart Apache
|
||||||
# notfound.php
|
|
||||||
# error500.php
|
|
||||||
# error503.php
|
|
||||||
|
|
|
@ -10,15 +10,19 @@
|
||||||
path: "/etc/letsencrypt/archive/{{ item.vhostname }}"
|
path: "/etc/letsencrypt/archive/{{ item.vhostname }}"
|
||||||
register: certificate_folder
|
register: certificate_folder
|
||||||
loop: "{{ vhosts }}"
|
loop: "{{ vhosts }}"
|
||||||
|
when: ssl
|
||||||
|
|
||||||
- name: Initialize need_certificate
|
- name: Initialize need_certificate
|
||||||
set_fact:
|
set_fact:
|
||||||
need_certificate: false
|
need_certificate: false
|
||||||
|
when: ssl
|
||||||
|
|
||||||
- name: Evaluate if need certificate
|
- name: Evaluate if need certificate
|
||||||
set_fact:
|
set_fact:
|
||||||
need_certificate: true
|
need_certificate: true
|
||||||
when: not item.stat.exists
|
when:
|
||||||
|
- not item.stat.exists
|
||||||
|
- ssl
|
||||||
loop: "{{ certificate_folder.results }}"
|
loop: "{{ certificate_folder.results }}"
|
||||||
|
|
||||||
- name: Ensure certificate is created if needed
|
- name: Ensure certificate is created if needed
|
||||||
|
|
Loading…
Reference in a new issue