2022-05-31 04:36:55 +00:00
|
|
|
---
|
2022-05-30 15:46:36 +00:00
|
|
|
- name: Remove default nginx config
|
|
|
|
file:
|
|
|
|
name: /etc/nginx/sites-enabled
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: Restore sites-enabled
|
|
|
|
file:
|
|
|
|
name: /etc/nginx/sites-enabled
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: Install system nginx config
|
2022-08-02 18:38:55 +00:00
|
|
|
copy:
|
|
|
|
src: static/nginx/nginx.conf
|
2022-05-30 15:46:36 +00:00
|
|
|
dest: /etc/nginx/nginx.conf
|
|
|
|
|
2022-05-31 18:48:01 +00:00
|
|
|
# setup our configs for each host (we don't want to
|
|
|
|
# overwrite certbot's changes, so if it already exists,
|
|
|
|
# don't copy!)
|
|
|
|
|
2022-05-30 15:46:36 +00:00
|
|
|
- name: Install nginx config for {{ domain }}
|
|
|
|
template:
|
|
|
|
src: templates/nginx/site.conf
|
|
|
|
dest: /etc/nginx/conf.d/{{ domain }}.conf
|
2022-05-31 18:48:01 +00:00
|
|
|
force: no
|
2022-05-30 15:46:36 +00:00
|
|
|
|
|
|
|
- name: Install nginx config for git.{{ domain }}
|
|
|
|
template:
|
|
|
|
src: templates/nginx/gitea.conf
|
|
|
|
dest: /etc/nginx/conf.d/git.{{ domain }}.conf
|
2022-05-31 18:48:01 +00:00
|
|
|
force: no
|
2022-05-30 15:46:36 +00:00
|
|
|
|
|
|
|
- name: Install nginx config for our Hidden Service
|
|
|
|
template:
|
|
|
|
src: templates/nginx/tor.conf
|
|
|
|
dest: /etc/nginx/conf.d/tor-{{ domain }}.conf
|
2022-05-31 18:48:01 +00:00
|
|
|
force: no
|
2022-05-30 15:46:36 +00:00
|
|
|
|
2022-08-02 18:32:19 +00:00
|
|
|
- name: Reload Nginx to install LetsEncrypt
|
2022-05-30 15:46:36 +00:00
|
|
|
service:
|
|
|
|
name: nginx
|
|
|
|
state: restarted
|
|
|
|
|
2022-05-31 18:48:01 +00:00
|
|
|
# certbot is a life saver. thank you certbot devs!
|
2022-05-30 15:46:36 +00:00
|
|
|
- name: Setup certbot
|
|
|
|
shell: "certbot --nginx --non-interactive --agree-tos -m {{ contact_email }} -d {{ domain }} -d git.{{ domain }}"
|
|
|
|
|
2022-08-02 18:32:19 +00:00
|
|
|
- name: Reload Nginx with LetsEncrypt installed
|
2022-05-30 15:46:36 +00:00
|
|
|
systemd:
|
|
|
|
name: nginx
|
|
|
|
enabled: yes
|
|
|
|
state: restarted
|