From c6f2fd36e0a8188e1f6b2a15b292e3d0a5610ac4 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Sun, 19 Mar 2023 17:18:01 +0100 Subject: =?UTF-8?q?=F0=9F=8E=89=20Initial=20commit=20of=20infra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jails/datagubbe/nginx.conf.j2 | 51 ++++++++++++++++++++++++++++++++++++++++++ jails/datagubbe/tasks.yaml | 52 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 jails/datagubbe/nginx.conf.j2 create mode 100644 jails/datagubbe/tasks.yaml (limited to 'jails/datagubbe') diff --git a/jails/datagubbe/nginx.conf.j2 b/jails/datagubbe/nginx.conf.j2 new file mode 100644 index 0000000..d772466 --- /dev/null +++ b/jails/datagubbe/nginx.conf.j2 @@ -0,0 +1,51 @@ +worker_processes 1; + +# This default error log path is compiled-in to make sure configuration parsing +# errors are logged somewhere, especially during unattended boot when stderr +# isn't normally logged anywhere. This path will be touched on every nginx +# start regardless of error log location configured here. See +# https://trac.nginx.org/nginx/ticket/147 for more info. +# +#error_log /var/log/nginx/error.log; +# + +#pid logs/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include mime.types; + default_type application/octet-stream; + + #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + # '$status $body_bytes_sent "$http_referer" ' + # '"$http_user_agent" "$http_x_forwarded_for"'; + + #access_log logs/access.log main; + + sendfile on; + #tcp_nopush on; + + #keepalive_timeout 0; + keepalive_timeout 65; + + #gzip on; + + server { + listen [::]:80; + server_name {{ server_name }}; + + #charset koi8-r; + + #access_log logs/host.access.log main; + + location / { + root {{ root }}; + index index.html index.htm; + } + } +} diff --git a/jails/datagubbe/tasks.yaml b/jails/datagubbe/tasks.yaml new file mode 100644 index 0000000..b10889c --- /dev/null +++ b/jails/datagubbe/tasks.yaml @@ -0,0 +1,52 @@ +- name: create webroot + jexec: + cmd: mkdir -p /var/www/html + jail: "{{ jail.name }}" + +- name: create index file + ansible.builtin.copy: + content: | + + + + + Welcome to datagubbe.dev + + + +

Datagubbe

+ + + dest: "{{ jailbase }}/{{ jail.name }}/var/www/html/index.html" + +- name: install nginx + community.general.pkgng: + name: + - nginx + state: latest + jail: "{{ jail.name }}" + +- name: create nginx config + ansible.builtin.template: + src: nginx.conf.j2 + dest: "{{ jailbase }}/{{ jail.name }}/usr/local/etc/nginx/nginx.conf" + vars: + root: "/var/www/html" + server_name: "datagubbe.dev" + +- name: enable nginx + community.general.sysrc: + name: nginx_enable + value: "YES" + jail: "{{ jail.name }}" + +- name: start nginx + jexec: + cmd: service nginx status || service nginx start + jail: "{{ jail.name }}" + -- cgit v1.2.3