ctucx.git: ansible-configs

My personal ansible roles and playbooks [deprecated in favor of nixos]

commit c8dcbf329bd6f36b367c37549eac4cab5686906d
parent d6c1c26727bfc56bd868d106b5f39b0dd348b0a1
Author: Leah Thein <leah@toaster.fritz.box>
Date: Wed, 2 Dec 2020 00:23:28 +0100

oeffi-web: add role
2 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/roles/oeffi-web/tasks/main.yml b/roles/oeffi-web/tasks/main.yml
@@ -0,0 +1,25 @@
+---
+
+- name: Install oeffi-web
+  apk:
+   name: oeffi-web
+   state: present
+   update_cache: yes
+
+- service:
+   name: oeffi-web
+   enabled: yes
+   state: restarted
+
+- name: copy nginx-vhost for oeffi-web to destination host 
+  template: 
+    src: oeffi-web-vhost.conf.j2
+    dest: /etc/nginx/conf.d/oeffi-web.conf
+    mode: 0644
+    owner: nginx
+    group: nginx
+
+- name: restart nginx
+  service:
+    name: nginx
+    state: restarted
diff --git a/roles/oeffi-web/templates/oeffi-web-vhost.conf.j2 b/roles/oeffi-web/templates/oeffi-web-vhost.conf.j2
@@ -0,0 +1,18 @@
+server {
+	listen 443 ssl;
+	listen [::]:443 ssl;
+
+	ssl_certificate "{{oeffi_web.ssl_cert}}";
+	ssl_certificate_key "{{oeffi_web.ssl_privkey}}";
+	include /etc/nginx/ssl.conf;
+	
+	server_name {{oeffi_web.domain}};
+
+	location / {
+		proxy_pass http://127.0.0.1:5000;
+	}
+
+	location /assets {
+		root /usr/share/oeffi-web;
+	}
+}