mastible/roles/mastodon-nginx/tasks/install.yml

20 lines
869 B
YAML
Raw Normal View History

---
# This role sets up a Let's Encrypt certificate for the
# Mastodon instance
- name: Make TLS certificate storage directory
file: name=/etc/ssl/letsencrypt/ state=directory
- name: Make sure /opt exists
file: name=/opt state=directory
- name: Clone acme.sh repository
git:
repo: https://github.com/Neilpang/acme.sh.git
dest: /opt/acme.sh
- name: Install acme.sh
shell: cd /opt/acme.sh && ./acme.sh --install
- name: Generate certificate using acme.sh
shell: /root/.acme.sh/acme.sh --issue --standalone -d {{ LOCAL_DOMAIN }} --pre-hook "service nginx stop"
ignore_errors: yes
- name: Install certificate in storage directory
shell: /root/.acme.sh/acme.sh --install-cert -d {{ LOCAL_DOMAIN }} --key-file /etc/ssl/letsencrypt/{{ LOCAL_DOMAIN }}.pem --fullchain-file /etc/ssl/letsencrypt/{{ LOCAL_DOMAIN }}.crt --reloadcmd "service nginx restart"