add logic for a fresh server

pull/5/head
eric 2021-01-13 15:28:38 -05:00
parent 84ec732324
commit a2f9c1832f
1 changed files with 30 additions and 0 deletions

View File

@ -78,6 +78,24 @@
group: "{{ user_name }}" group: "{{ user_name }}"
mode: 0755 mode: 0755
- name: Create .well-known directory for fresh server
become: yes
file:
path: "/var/www/html/.well-known"
state: directory
owner: "{{ user_name }}"
group: "{{ user_name }}"
mode: 0755
- name: Create acme-challenge directory for fresh server
become: yes
file:
path: "/var/www/html/.well-known/acme-challenge"
state: directory
owner: "{{ user_name }}"
group: "{{ user_name }}"
mode: 0755
- name: debug - name: debug
debug: debug:
msg: "{{ acme_challenge }}" msg: "{{ acme_challenge }}"
@ -94,6 +112,18 @@
content: "{{ acme_challenge['challenge_data'][alt_server_name]['http-01']['resource_value'] }}" content: "{{ acme_challenge['challenge_data'][alt_server_name]['http-01']['resource_value'] }}"
when: acme_challenge is changed and alt_server_name != '' and alt_server_name in acme_challenge['challenge_data'] when: acme_challenge is changed and alt_server_name != '' and alt_server_name in acme_challenge['challenge_data']
- name: copy main challenge for fresh server
copy:
dest: /var/www/html/{{ acme_challenge['challenge_data'][server_name]['http-01']['resource'] }}
content: "{{ acme_challenge['challenge_data'][server_name]['http-01']['resource_value'] }}"
when: acme_challenge is changed and server_name in acme_challenge['challenge_data']
- name: copy alt challenge for fresh server
copy:
dest: /var/www/html/{{ acme_challenge['challenge_data'][alt_server_name]['http-01']['resource'] }}
content: "{{ acme_challenge['challenge_data'][alt_server_name]['http-01']['resource_value'] }}"
when: acme_challenge is changed and alt_server_name != '' and alt_server_name in acme_challenge['challenge_data']
- name: Create a challenge for server_name using a account key file. - name: Create a challenge for server_name using a account key file.
acme_certificate: acme_certificate:
account_key_src: private/decrypted/letsencrypt_account.key account_key_src: private/decrypted/letsencrypt_account.key