summaryrefslogtreecommitdiff
path: root/website.yaml
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-03-23 14:09:58 +0300
committereug-vs <eugene@eug-vs.xyz>2022-03-23 14:09:58 +0300
commit29d16c46dfbc8eb9a31b10a5bf72f1330c890d5c (patch)
tree07bec8926ee075116c30191ce86652cc0ebbbb3e /website.yaml
downloadinfrastructure-29d16c46dfbc8eb9a31b10a5bf72f1330c890d5c.tar.gz
feat: add website and git-server playbooks
Diffstat (limited to 'website.yaml')
-rw-r--r--website.yaml40
1 files changed, 40 insertions, 0 deletions
diff --git a/website.yaml b/website.yaml
new file mode 100644
index 0000000..818fa81
--- /dev/null
+++ b/website.yaml
@@ -0,0 +1,40 @@
+---
+- name: Setup website
+ hosts: raspberry
+ tasks:
+ - name: Install packages
+ become: true
+ tags:
+ - slow
+ apt:
+ pkg:
+ - nginx
+ - certbot
+ - python3-certbot-nginx
+
+ - name: Copy nginx configuration
+ become: true
+ copy:
+ src: ./files/nginx/website
+ dest: /etc/nginx/sites-available
+
+ - name: Enable website
+ become: true
+ command: "ln -sf /etc/nginx/sites-available/website /etc/nginx/sites-enabled"
+
+ - name: Install SSL certificate
+ become: true
+ shell: "certbot --nginx --non-interactive --agree-tos -m eugene@eug-vs.xyz -d eug-vs.xyz -d www.eug-vs.xyz"
+
+ - name: Allow user to write to website location
+ become: true
+ shell: |
+ mkdir -p /var/www/website
+ chown -R eug-vs:eug-vs /var/www/website
+
+ - name: Restart and enable nginx
+ become: true
+ systemd:
+ name: nginx
+ enabled: yes
+ state: restarted