-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves: #17
- Loading branch information
Showing
8 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
|
||
# possibly just copy the script into files and include it w/ the role? | ||
- name: Clone acme-tiny to /opt [Let's Encrypt!] | ||
git: | ||
dest: "{{ rocket_chat_letsencrypt_acmetiny_path }}" | ||
repo: https://github.com/diafygi/acme-tiny.git | ||
force: yes | ||
update: yes | ||
|
||
- name: Ensure letsencrypt well-known dir exists [Let's Encrypt!] | ||
file: | ||
path: "{{ rocket_chat_letsencrypt_wellknown_path }}" | ||
state: directory | ||
owner: "{{ rocket_chat_nginx_process_user }}" | ||
|
||
- name: Generate acme-tiny Let's Encrypt account key [Let's Encrypt!] | ||
shell: >- | ||
openssl genrsa -out {{ rocket_chat_letsencrypt_account_key }} 4096 | ||
args: | ||
creates: "{{ rocket_chat_letsencrypt_account_key }}" | ||
|
||
- name: Check if acme-tiny Let's Encrypt CSR exists [Let's Encrypt!] | ||
stat: | ||
path: "{{ rocket_chat_letsencrypt_csr }}" | ||
register: csr_path | ||
|
||
- name: Generate acme-tiny Let's Encrypt CSR [Let's Encrypt!] | ||
shell: >- | ||
openssl req -new -sha256 -key {{ rocket_chat_ssl_key_path }} | ||
-subj "/CN={{ rocket_chat_letsencrypt_domain | default(rocket_chat_service_host) }}" | ||
-out {{ rocket_chat_letsencrypt_csr }} | ||
when: | ||
- (key_gen_result | changed) or | ||
not csr_path.stat.exists | ||
register: csr_gen_result | ||
|
||
- name: Setup script in cron.daily [Let's Encrypt!] | ||
copy: | ||
dest: /etc/cron.monthly/acme-tiny_renew.sh | ||
mode: 0755 | ||
content: | | ||
#!/bin/bash | ||
python {{ rocket_chat_letsencrypt_acmetiny_path }}/acme_tiny.py \ | ||
--account-key {{ rocket_chat_letsencrypt_account_key }} \ | ||
--csr {{ rocket_chat_letsencrypt_csr }} \ | ||
--acme-dir {{ rocket_chat_letsencrypt_wellknown_path }} \ | ||
> {{ rocket_chat_ssl_cert_path }} || exit | ||
curl -s {{ rocket_chat_letsencrypt_ca_cert }} \ | ||
>> {{ rocket_chat_ssl_cert_path }} && | ||
nginx -t && nginx -s reload | ||
- name: Run acme-tiny_renew.sh (first run cert creation) [Let's Encrypt!] | ||
shell: /etc/cron.monthly/acme-tiny_renew.sh | ||
notify: Reload the Nginx service | ||
when: csr_gen_result | changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ rocket_chat_dep_packages: | |
- npm | ||
- make | ||
- wget | ||
- crontabs | ||
|
||
rocket_chat_mongodb_packages: | ||
- mongodb | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters