2021-12-26 22:08:10 +00:00
|
|
|
# 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: alpha
|
|
|
|
become: yes
|
|
|
|
tasks:
|
|
|
|
- name: Install Nginx
|
|
|
|
apt:
|
|
|
|
name: nginx
|
|
|
|
update_cache: yes
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Update Snap
|
|
|
|
community.general.snap:
|
|
|
|
name: core
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Install Certbot
|
|
|
|
community.general.snap:
|
|
|
|
name: certbot
|
|
|
|
classic: yes
|
|
|
|
|
2022-06-15 04:17:59 +00:00
|
|
|
- name: Push Configs
|
2021-12-26 22:08:10 +00:00
|
|
|
copy:
|
2022-06-15 04:17:59 +00:00
|
|
|
src: "{{item}}"
|
|
|
|
dest: "/etc/nginx/sites-available/{{item}}"
|
|
|
|
loop:
|
|
|
|
- search.project-athens.xyz
|
2022-07-25 06:33:50 +00:00
|
|
|
- files.leftcoast.space
|
2021-12-26 22:08:10 +00:00
|
|
|
|
2022-06-15 04:17:59 +00:00
|
|
|
- name: Enable Sites in Nginx
|
2021-12-26 22:08:10 +00:00
|
|
|
file:
|
2022-06-15 04:17:59 +00:00
|
|
|
src: "/etc/nginx/sites-available/{{item}}"
|
|
|
|
dest: "/etc/nginx/sites-enabled/{{item}}"
|
2021-12-26 22:08:10 +00:00
|
|
|
state: link
|
2022-06-15 04:17:59 +00:00
|
|
|
loop:
|
|
|
|
- search.project-athens.xyz
|
2022-07-25 06:33:50 +00:00
|
|
|
- files.leftcoast.space
|
2021-12-26 22:08:10 +00:00
|
|
|
|
|
|
|
- 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:
|
|
|
|
- search.project-athens.xyz
|
2022-07-25 06:33:50 +00:00
|
|
|
- files.leftcoast.space
|