Refactor a little bit

This commit is contained in:
Salt 2020-02-05 21:26:03 -06:00
parent 9e14dc5426
commit 96a9671052
2 changed files with 10 additions and 13 deletions

View File

@ -10,6 +10,7 @@
acme_directory: "https://acme-staging-v02.api.letsencrypt.org/directory"
acme_version: 2
website_url: "nc.assburgers.club"
website_root: "/var/www/nextcloud"
roles:
- nextcloud
- hosts: tag_role_cockpit

View File

@ -23,17 +23,13 @@
- python-openssl # Needed for keygen
- python3-openssl
- name: Copy configuration
block:
- name: php-apache2
copy:
src: php-apache2.ini
dest: /etc/php/7.2/apache2/php.ini
mode: 644
- name: php-cgi
copy:
src: php-cgi.ini
dest: /etc/php/7.2/cgi/php.ini
mode: 644
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "{{ item.mode }}"
loop:
- { src: "php-apache2.ini", dest: "/etc/php/7.2/apache2/php.ini", mode: "0644" }
- { src: "php-cgi.ini", dest: "/etc/php/7.2/cgi/php.ini", mode: "0644" }
- name: Register certificates
block:
- name: Set up our filesystem heirarchy
@ -66,7 +62,7 @@
- name: Create well-known directory
file:
mode: "0644"
path: "/var/www/html/.well-known/acme-challenge"
path: "{{ website_root }}/.well-known/acme-challenge"
state: directory
- name: Create challenge for CSR
acme_certificate:
@ -81,7 +77,7 @@
register: com_challenge
- name: Fulfill challenge
copy:
dest: "/var/www/html/{{ com_challenge['challenge_data'][website_url]['http-01']['resource'] }}"
dest: "{{ website_root }}/{{ com_challenge['challenge_data'][website_url]['http-01']['resource'] }}"
content: "{{ com_challenge['challenge_data'][website_url]['http-01']['resource_value'] }}"
when: com_challenge is changed
- name: Create certificate