copy nginx config nevertheles if cert is present
This commit is contained in:
@@ -1,25 +1,23 @@
|
|||||||
---
|
---
|
||||||
- stat: path=/etc/letsencrypt/live/{{ mastodon_host }}/fullchain.pem
|
- stat: path=/etc/letsencrypt/live/{{ mastodon_host | default({{ ansible_fqdn }}) }}/fullchain.pem
|
||||||
register: letsencrypt_cert
|
register: letsencrypt_cert
|
||||||
|
|
||||||
- name: Copy letsencrypt nginx config
|
- name: Copy letsencrypt nginx config
|
||||||
template:
|
template:
|
||||||
src: ../files/nginx/letsencrypt.conf.j2
|
src: ../files/nginx/letsencrypt.conf.j2
|
||||||
dest: /etc/nginx/sites-available/mastodon.conf
|
dest: /etc/nginx/sites-available/mastodon.conf
|
||||||
when: not letsencrypt_cert.stat.exists
|
|
||||||
|
|
||||||
- name: Symlink enabled site
|
- name: Symlink enabled site
|
||||||
file:
|
file:
|
||||||
src: "/etc/nginx/sites-available/mastodon.conf"
|
src: "/etc/nginx/sites-available/mastodon.conf"
|
||||||
dest: "/etc/nginx/sites-enabled/mastodon.conf"
|
dest: "/etc/nginx/sites-enabled/mastodon.conf"
|
||||||
state: link
|
state: link
|
||||||
when: not letsencrypt_cert.stat.exists
|
|
||||||
|
|
||||||
- name: Reload nginx
|
- name: Reload nginx
|
||||||
command: "systemctl reload nginx"
|
command: "systemctl reload nginx"
|
||||||
|
|
||||||
- name: Install letsencrypt cert
|
- name: Install letsencrypt cert
|
||||||
command: letsencrypt certonly -n --webroot -d {{ mastodon_host }} -w {{ mastodon_home }}/{{ mastodon_path }}/public/ --email "webmaster@{{ mastodon_host }}" --agree-tos && systemctl reload nginx
|
command: letsencrypt certonly -n --webroot -d {{ mastodon_host | default({{ ansible_fqdn }}) }} -w {{ mastodon_home }}/{{ mastodon_path }}/public/ --email "webmaster@{{ mastodon_host | default({{ ansible_fqdn }}) }}" --agree-tos && systemctl reload nginx
|
||||||
when: not letsencrypt_cert.stat.exists
|
when: not letsencrypt_cert.stat.exists
|
||||||
|
|
||||||
- name: Letsencrypt Job
|
- name: Letsencrypt Job
|
||||||
|
|||||||
Reference in New Issue
Block a user