library/roles/apache: Use a variable to decide if apache will use the letsencrypt certificates or not.

This commit is contained in:
Andrea Dell'Amico 2016-04-22 18:16:45 +02:00
parent 46b2d2cae8
commit 22e69a2c8e
3 changed files with 13 additions and 6 deletions

View File

@ -73,6 +73,7 @@ apache_additional_modules_list:
# -
# -
apache_letsencrypt_managed: False
apache_letsencrypt_proxy_modules:
- proxy
- proxy_http

View File

@ -2,15 +2,17 @@
- block:
- name: Enable the proxy modules needed by letsencrypt
apache2_module: name={{ item }} state=present
notify: apache2 reload
with_items: '{{ apache_letsencrypt_proxy_modules }}'
notify: apache2 reload
- name: Install the letsencrypt conf
template: src=letsencrypt-proxy.conf.j2 dest=/etc/apache2/conf-available/letsencrypt-proxy.conf owner=root group=root mode=0644
template: src={{ item }}.j2 dest=/etc/apache2/conf-available/{{ item }} owner=root group=root mode=0644
with_items: '{{ apache_letsencrypt_proxy_conf }}'
notify: apache2 reload
- name: Enable the letsencrypt conf
file: src=/etc/apache2/conf-available/letsencrypt-proxy.conf dest=/etc/apache2/conf-enabled/letsencrypt-proxy.conf state=link
file: src=/etc/apache2/conf-available/{{ item }} dest=/etc/apache2/conf-enabled/{{ item }} state=link
with_items: '{{ apache_letsencrypt_proxy_conf }}'
notify: apache2 reload
- name: Create the acme hooks directory if it does not yet exist
@ -19,7 +21,9 @@
- name: Install a letsencrypt hook for apache
copy: src=apache-letsencrypt-acme.sh dest={{ letsencrypt_acme_services_scripts_dir }}/apache2 owner=root group=root mode=4555
when: letsencrypt_acme_install is defined and letsencrypt_acme_install
when:
- letsencrypt_acme_install is defined and letsencrypt_acme_install
- apache_letsencrypt_managed
tags: [ 'apache', 'letsencrypt' ]
- block:
@ -31,5 +35,5 @@
file: path={{ letsencrypt_acme_services_scripts_dir }}/apache2 state=absent
when: ( letsencrypt_acme_install is defined ) and ( not letsencrypt_acme_install )
tags: [ 'apache', 'apache_mods', 'letsencrypt' ]
tags: [ 'apache', 'letsencrypt' ]

View File

@ -4,4 +4,6 @@
- include: apache-basic-auth.yml
when: apache_basic_auth
- include: apache-letsencrypt.yml
when: letsencrypt_acme_install is defined and letsencrypt_acme_install
when:
- letsencrypt_acme_install is defined and letsencrypt_acme_install
- apache_letsencrypt_managed