diff options
| author | 2026-10-22 20:20:17 +0000 | |
|---|---|---|
| committer | 2026-10-22 20:20:17 +0000 | |
| commit | 62428777b7862720c1441e126a26f53c6076ba94 (patch) | |
| tree | c39ae0c841e5f20f5155cbc8776a6d61e634d3cb | |
| parent | feat: add personal site (diff) | |
| download | infra-62428777b7862720c1441e126a26f53c6076ba94.tar.gz | |
feat: add cosmos site
| -rw-r--r-- | provision.yml | 1 | ||||
| -rw-r--r-- | roles/cosmos/tasks/main.yml | 22 | ||||
| -rw-r--r-- | roles/cosmos/templates/nginx.conf.j2 | 71 |
3 files changed, 94 insertions, 0 deletions
diff --git a/provision.yml b/provision.yml index ac181c2..39058da 100644 --- a/provision.yml +++ b/provision.yml | |||
| @@ -32,3 +32,4 @@ | |||
| 32 | - role: nginx | 32 | - role: nginx |
| 33 | 33 | ||
| 34 | - role: personal | 34 | - role: personal |
| 35 | - role: cosmos | ||
diff --git a/roles/cosmos/tasks/main.yml b/roles/cosmos/tasks/main.yml new file mode 100644 index 0000000..c44505e --- /dev/null +++ b/roles/cosmos/tasks/main.yml | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | --- | ||
| 2 | - block: | ||
| 3 | - name: Ensure cosmos web root exists | ||
| 4 | ansible.builtin.file: | ||
| 5 | path: /srv/http/cosmos.party | ||
| 6 | state: directory | ||
| 7 | owner: cmmm | ||
| 8 | group: www-data | ||
| 9 | mode: '0775' | ||
| 10 | |||
| 11 | - name: Deploy cosmos nginx site configuration | ||
| 12 | ansible.builtin.template: | ||
| 13 | src: nginx.conf.j2 | ||
| 14 | dest: /etc/nginx/http.d/cosmos.conf | ||
| 15 | owner: root | ||
| 16 | group: root | ||
| 17 | mode: '0444' | ||
| 18 | validate: nginx-validate %s /etc/nginx/http.d/cosmos.conf | ||
| 19 | notify: Reload nginx | ||
| 20 | |||
| 21 | tags: | ||
| 22 | - cosmos | ||
diff --git a/roles/cosmos/templates/nginx.conf.j2 b/roles/cosmos/templates/nginx.conf.j2 new file mode 100644 index 0000000..b9b6c67 --- /dev/null +++ b/roles/cosmos/templates/nginx.conf.j2 | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | # -*- Nginx -*- | ||
| 2 | # {{ ansible_managed }} | ||
| 3 | |||
| 4 | server { | ||
| 5 | listen 80; | ||
| 6 | listen [::]:80; | ||
| 7 | server_name cosmos.party | ||
| 8 | www.cosmos.party | ||
| 9 | git.cosmos.party | ||
| 10 | lists.cosmos.party | ||
| 11 | andr.cosmos.party; | ||
| 12 | |||
| 13 | location ^~ /.well-known/acme-challenge/ { | ||
| 14 | root /var/www/acme; | ||
| 15 | } | ||
| 16 | |||
| 17 | location / { | ||
| 18 | return 307 https://$host$request_uri; | ||
| 19 | } | ||
| 20 | } | ||
| 21 | |||
| 22 | server { | ||
| 23 | server_name cosmos.party | ||
| 24 | www.cosmos.party; | ||
| 25 | |||
| 26 | listen unix:/var/run/nginx/http.sock; | ||
| 27 | listen 443 ssl; | ||
| 28 | listen [::]:443 ssl; | ||
| 29 | listen 443 quic; | ||
| 30 | listen [::]:443 quic; | ||
| 31 | |||
| 32 | http2 on; | ||
| 33 | http3 on; | ||
| 34 | |||
| 35 | add_header Alt-Svc 'h3=":443"; ma=86400'; | ||
| 36 | |||
| 37 | ssl_certificate /etc/ssl/cosmos.party.fullchain.pem; | ||
| 38 | ssl_certificate_key /etc/ssl/private/cosmos.party.key; | ||
| 39 | ssl_protocols TLSv1.2 TLSv1.3; | ||
| 40 | |||
| 41 | root /srv/http/cosmos.party; | ||
| 42 | index index.html; | ||
| 43 | |||
| 44 | location /en/ { try_files $uri $uri/ =404; } | ||
| 45 | location /ru/ { try_files $uri $uri/ =404; } | ||
| 46 | location /sk/ { try_files $uri $uri/ =404; } | ||
| 47 | location / { try_files $uri /en$uri /en$uri/ =404; } | ||
| 48 | } | ||
| 49 | |||
| 50 | server { | ||
| 51 | server_name andr.cosmos.party; | ||
| 52 | |||
| 53 | |||
| 54 | listen unix:/var/run/nginx/http.sock; | ||
| 55 | listen 443 ssl; | ||
| 56 | listen [::]:443 ssl; | ||
| 57 | listen 443 quic; | ||
| 58 | listen [::]:443 quic; | ||
| 59 | |||
| 60 | http2 on; | ||
| 61 | http3 on; | ||
| 62 | |||
| 63 | ssl_certificate /etc/ssl/cosmos.party.fullchain.pem; | ||
| 64 | ssl_certificate_key /etc/ssl/private/cosmos.party.key; | ||
| 65 | ssl_protocols TLSv1.2 TLSv1.3; | ||
| 66 | |||
| 67 | add_header Alt-Svc 'h3=":443"; ma=86400'; | ||
| 68 | |||
| 69 | root /srv/http/$host; | ||
| 70 | autoindex on; | ||
| 71 | } | ||
