From c5c9f75cc84fa371a6ac3927c01b674f35b66d87 Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Sun, 14 May 2023 19:08:15 +0800 Subject: [PATCH] Include ssh port, country, isp and wiki page in inventory.yml --- all/templates/sshd_config.j2 | 6 +----- inventory.yml | 13 +++++++++++++ privfrontends/compose/gothub-dev/compose.yml.j2 | 12 ++---------- privfrontends/compose/librarian/extras.conf.j2 | 12 ++---------- privfrontends/compose/rimgo/compose.yml.j2 | 12 ++---------- privfrontends/templates/Caddyfile.j2 | 9 +-------- 6 files changed, 21 insertions(+), 43 deletions(-) diff --git a/all/templates/sshd_config.j2 b/all/templates/sshd_config.j2 index 99a4af4..e5d374a 100644 --- a/all/templates/sshd_config.j2 +++ b/all/templates/sshd_config.j2 @@ -1,8 +1,4 @@ -{% if inventory_hostname == 'eu' %} -Port 222 -{% else %} -Port 22 -{% endif %} +Port {{port}} PermitRootLogin prohibit-password PasswordAuthentication no PermitEmptyPasswords no diff --git a/inventory.yml b/inventory.yml index d75a7d8..a395d14 100644 --- a/inventory.yml +++ b/inventory.yml @@ -6,6 +6,7 @@ all: ansible_host: soleil.projectsegfau.lt ansible_user: user ansible_port: 2270 + port: 22 ansible_become: yes # Run everything as root privfrontends: hosts: @@ -13,17 +14,29 @@ all: ansible_host: pizza1.projectsegfau.lt ansible_user: arya ansible_port: 222 + port: 222 ansible_become: yes # Run everything as root caddy_extras_config: templates/1-extras.Caddyfile + country: Luxembourg + isp: BuyVM + wiki_page: Pizza1 us: ansible_host: us.projectsegfau.lt ansible_user: arya ansible_port: 22 + port: 22 ansible_become: yes # Run everything as root caddy_extras_config: templates/2-extras.Caddyfile + country: United States + isp: Digital Ocean + wiki_page: US_Node in: ansible_host: in.projectsegfau.lt ansible_user: root ansible_port: 6922 + port: 22 caddy_extras_config: templates/3-extras.Caddyfile + country: India + isp: Bharti Airtel + wiki_page: India_Node diff --git a/privfrontends/compose/gothub-dev/compose.yml.j2 b/privfrontends/compose/gothub-dev/compose.yml.j2 index 433c9be..ccf6f63 100644 --- a/privfrontends/compose/gothub-dev/compose.yml.j2 +++ b/privfrontends/compose/gothub-dev/compose.yml.j2 @@ -14,16 +14,8 @@ services: - GOTHUB_USER_AGENT_LOGGED=false - GOTHUB_DIAGNOSTIC_INFO_LOGGED=false - GOTHUB_INSTANCE_PRIVACY_POLICY=https://projectsegfau.lt/legal/privacy-policy - {% if inventory_hostname == 'eu' %} - - GOTHUB_INSTANCE_COUNTRY=Luxembourg - - GOTHUB_INSTANCE_PROVIDER=BuyVM - {% else if inventory_hostname == 'us' %} - - GOTHUB_INSTANCE_COUNTRY=United States - - GOTHUB_INSTANCE_PROVIDER=Digital Ocean - {% else if inventory_hostname == 'in' %} - - GOTHUB_INSTANCE_COUNTRY=India - - GOTHUB_INSTANCE_PROVIDER=Bharti Airtel - {% endif %} + - GOTHUB_INSTANCE_COUNTRY={{country}} + - GOTHUB_INSTANCE_PROVIDER={{isp}} - GOTHUB_INSTANCE_CLOUDFLARE=false healthcheck: test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/version || exit 1 diff --git a/privfrontends/compose/librarian/extras.conf.j2 b/privfrontends/compose/librarian/extras.conf.j2 index a99816a..8b870f7 100644 --- a/privfrontends/compose/librarian/extras.conf.j2 +++ b/privfrontends/compose/librarian/extras.conf.j2 @@ -59,16 +59,8 @@ INSTANCE_PRIVACY: DATA_COLLECTED_DEVICE: true DATA_COLLECTED_DIAGNOSTIC_ONLY: false - {% if inventory_hostname == 'eu' %} - INSTANCE_COUNTRY: "Luxembourg" - INSTANCE_PROVIDER: "BuyVM" - {% else if inventory_hostname == 'us' %} - INSTANCE_COUNTRY: "United States" - INSTANCE_PROVIDER: "Digital Ocean" - {% else if inventory_hostname == 'in' %} - INSTANCE_COUNTRY: "India" - INSTANCE_PROVIDER: "Bharti Airtel" - {% endif %} + INSTANCE_COUNTRY: "{{country}}" + INSTANCE_PROVIDER: "{{isp}}" # Cloudflare use is discouraged. You can set this to false if it is not proxied (gray cloud icon) INSTANCE_CLOUDFLARE: false diff --git a/privfrontends/compose/rimgo/compose.yml.j2 b/privfrontends/compose/rimgo/compose.yml.j2 index f8076d2..0031f1c 100644 --- a/privfrontends/compose/rimgo/compose.yml.j2 +++ b/privfrontends/compose/rimgo/compose.yml.j2 @@ -10,16 +10,8 @@ services: - IMGUR_CLIENT_ID=546c25a59c58ad7 - PRIVACY_POLICY=https://projectsegfau.lt/legal/privacy-policy - PRIVACY_MESSAGE= - {% if inventory_hostname == 'eu' %} - - PRIVACY_COUNTRY=Luxembourg - - PRIVACY_PROVIDER=BuyVM - {% else if inventory_hostname == 'us' %} - - PRIVACY_COUNTRY=USA - - PRIVACY_PROVIDER=Digital Ocean - {% else if inventory_hostname == 'in' %} - - PRIVACY_COUNTRY=India - - PRIVACY_PROVIDER=Bharti Airtel - {% endif %} + - PRIVACY_COUNTRY={{country}} + - PRIVACY_PROVIDER={{isp}} - PRIVACY_CLOUDFLARE=false - PRIVACY_NOT_COLLECTED=true restart: unless-stopped diff --git a/privfrontends/templates/Caddyfile.j2 b/privfrontends/templates/Caddyfile.j2 index 0d88abf..4866260 100644 --- a/privfrontends/templates/Caddyfile.j2 +++ b/privfrontends/templates/Caddyfile.j2 @@ -54,14 +54,7 @@ {% endif %} } {{inventory_hostname}}.projectsegfau.lt {% if inventory_hostname == 'eu' %} pizza1.projectsegfau.lt {% endif %} { -{% if inventory_hostname == 'eu' %} - redir https://wiki.projectsegfau.lt/index.php?title=Pizza1 -{% elif inventory_hostname == 'us' %} - redir https://wiki.projectsegfau.lt/index.php?title=US_Node -{% elif inventory_hostname == 'in' %} - redir https://wiki.projectsegfau.lt/index.php?title=India_Node -{% else %} -{% endif %} + redir https://wiki.projectsegfau.lt/index.php?title={{wiki_page}} } cdn.projectsegfau.lt cdn.{{inventory_hostname}}.projectsegfau.lt { encode zstd gzip