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_directory: "https://acme-staging-v02.api.letsencrypt.org/directory"
acme_version: 2 acme_version: 2
website_url: "nc.assburgers.club" website_url: "nc.assburgers.club"
website_root: "/var/www/nextcloud"
roles: roles:
- nextcloud - nextcloud
- hosts: tag_role_cockpit - hosts: tag_role_cockpit

View File

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