infra/playbooks/atlas/init/setup-reverse-proxy.yml
shockrah 025b0539a6 All services now migrated and tested to be working as intended
These configurations should be valid enough to perform a really fast migration
should something weird happen. Check the runbook created for this commit
to see the steps involved.
2022-11-09 00:43:29 -08:00

49 lines
1.2 KiB
YAML

# This playbook just installs nginx so that it is ready to configure
# we don't bother with extra user accounts like with Beta because we
# are only concerned with using nginx to serve fully containerized
# applications. Not static files
---
- hosts: atlas
become: yes
vars:
CERT_EMAIL: "dev@shockrah.xyz"
SITES:
- search.project-athens.xyz
- files.leftcoast.space
- clips.shockrah.xyz
tasks:
- name: Install nginx
apt:
name: nginx
state: latest
- name: Install Certbot
community.general.snap:
name: certbot
classic: yes
- name: Push Configs
copy:
src: "{{ '../nginx-plain-conf/' ~ item }}"
dest: "{{ '/etc/nginx/sites-available/' ~ item }}"
loop: "{{ SITES }}"
- name: Enable Sites in Nginx
file:
src: "/etc/nginx/sites-available/{{item}}"
dest: "/etc/nginx/sites-enabled/{{item}}"
state: link
loop: "{{ SITES }}"
- name: Restart Nginx
service:
name: nginx
state: restarted
- name: Install Certificates for all sites on this host
command: >
certbot -n --nginx -m "{{ CERT_EMAIL }}" --agree-tos
--domains "{{item}}"
loop: "{{ SITES }}"