Migrate redirect to new https behavior

This commit is contained in:
Salt 2020-02-20 05:27:03 -06:00
parent 6ea78323b3
commit b77975c199

View File

@ -3,42 +3,17 @@
--- ---
- name: Set up redirect - name: Set up redirect
block: block:
- name: Set up Apache - name: Copy over redirect config
block:
# Why does a redirect need a webroot?
# Answer: SSL certification
- name: Create webroot
file:
path: "{{ redirect_webroot }}"
mode: "0755"
recurse: yes
state: directory
- name: Register certificates
block:
- name: Configure temporary virtual host configs
template: template:
src: apache2-vhost.conf src: apache2-redirect.conf
dest: "/etc/apache2/sites-enabled/{{ redirect_from }}.conf" dest: "/etc/apache2/sites-enabled/{{ redirect_from }}.conf"
- name: Generate certificate - name: Generate certificate
include_role: include_role:
name: https name: https
vars: vars:
website_url: "{{ redirect_from }}" website_url: "{{ redirect_from }}"
website_webroot: "{{ redirect_webroot }}"
- name: Remove webroot
file:
path: "{{ redirect_webroot }}"
state: absent
- name: Configure Apache
block:
# If we copied over http-only configs before, they get oblooterated now
- name: Copy over redirect config
template:
src: apache2-redirect.conf
dest: "/etc/apache2/sites-enabled/{{ redirect_from }}.conf"
- name: Reload Apache - name: Reload Apache
service: service:
name: apache2 name: apache2
state: reloaded state: reloaded
enabled: true
become: yes become: yes