Compare commits

..

2 Commits

Author SHA1 Message Date
5fb2872fa2 implemented new default urls 2023-12-12 01:44:37 +01:00
58f95508d8 Removed debuging message 2023-12-11 19:45:42 +01:00
10 changed files with 94 additions and 46 deletions

View File

@ -32,7 +32,44 @@ path_docker_volumes: "{{path_administrator_home}}volume
path_docker_compose_instances: "{{path_administrator_home}}docker-compose/" path_docker_compose_instances: "{{path_administrator_home}}docker-compose/"
# Runtime Variables # Runtime Variables
activate_all_timers: false # Activates all timers, independend if the handlers had been triggered activate_all_timers: false # Activates all timers, independend if the handlers had been triggered
nginx_matomo_tracking: false # Activates matomo tracking on all html pages nginx_matomo_tracking: false # Activates matomo tracking on all html pages
nginx_www_redirect: true # Implements an redirect from all www. domains to the main domain nginx_www_redirect: true # Implements an redirect from all www. domains to the main domain
execute_updates: true # Executes updates execute_updates: true # Executes updates
# Domain Names
domain_akaunting: "akaunting.{{top_domain}}"
domain_baserow: "baserow.{{top_domain}}"
domain_bigbluebutton: "meet.{{top_domain}}"
domain_elk: "elk.{{top_domain}}"
domain_discourse: "forum.{{top_domain}}"
domain_funkwhale: "music.{{top_domain}}"
domain_gitea: "git.{{top_domain}}"
domain_listmonk: "newsletter.{{top_domain}}"
domain_mailu: "mail.{{top_domain}}"
domain_mastodon: "microblog.{{top_domain}}"
domains_mastodon_alternates: []
domain_matomo: "matomo.{{top_domain}}"
domain_mediawiki: "wiki.{{top_domain}}"
domain_nextcloud: "cloud.{{top_domain}}"
domain_pixelfed: "pictures.{{top_domain}}"
domains_pixelfed: []
domain_peertube: "videos.{{top_domain}}"
domains_peertube: []
domain_roulette: "roulette.{{top_domain}}"
domain_attendize: "tickets.{{top_domain}}"
domain_yourls: "s.{{top_domain}}"
# Routings
redirect_domain_mappings:
- { source: "nextcloud.{{top_domain}}", target: "cloud.{{top_domain}}" }
- { source: "gitea.{{top_domain}}", target: "git.{{top_domain}}" }
- { source: "listmonk.{{top_domain}}", target: "newsletter.{{top_domain}}" }
- { source: "discourse.{{top_domain}}", target: "forum.{{top_domain}}" }
- { source: "bbb.{{top_domain}}", target: "meet.{{top_domain}}" }
- { source: "short.{{top_domain}}", target: "s.{{top_domain}}" }
- { source: "mastodon.{{top_domain}}", target: "microblog.{{top_domain}}" }
- { source: "peertube.{{top_domain}}", target: "videos.{{top_domain}}" }
- { source: "funkwhale.{{top_domain}}", target: "music.{{top_domain}}" }
- { source: "pixelfed.{{top_domain}}", target: "pictures.{{top_domain}}" }

View File

@ -19,7 +19,7 @@
roles: roles:
- role: docker-nextcloud - role: docker-nextcloud
vars: vars:
domain: cloud.{{top_domain}} domain: "{{domain_nextcloud}}"
http_port: 8001 http_port: 8001
- name: setup gitea hosts - name: setup gitea hosts
@ -28,7 +28,7 @@
roles: roles:
- role: docker-gitea - role: docker-gitea
vars: vars:
domain: git.{{top_domain}} domain: "{{domain_gitea}}"
http_port: 8002 http_port: 8002
ssh_port: 2201 ssh_port: 2201
run_mode: prod run_mode: prod
@ -48,7 +48,7 @@
roles: roles:
- role: docker-mediawiki - role: docker-mediawiki
vars: vars:
domain: wiki.{{top_domain}} domain: "{{domain_mediawiki}}"
http_port: 8004 http_port: 8004
- name: setup mybb hosts - name: setup mybb hosts
@ -57,7 +57,7 @@
roles: roles:
- role: docker-mybb - role: docker-mybb
vars: vars:
domains: "{{mybb_domains}}" domains: "{{domains_mybb}}"
http_port: 8005 http_port: 8005
- name: setup yourls hosts - name: setup yourls hosts
@ -66,7 +66,7 @@
roles: roles:
- role: docker-yourls - role: docker-yourls
vars: vars:
domain: s.{{top_domain}} domain: "{{domain_yourls}}"
http_port: 8006 http_port: 8006
- name: setup mailu hosts - name: setup mailu hosts
@ -75,7 +75,7 @@
roles: roles:
- role: docker-mailu - role: docker-mailu
vars: vars:
domain: "mail.{{top_domain}}" domain: "{{domain_mailu}}"
http_port: 8007 http_port: 8007
- name: setup elk hosts - name: setup elk hosts
@ -84,7 +84,7 @@
roles: roles:
- role: docker-elk - role: docker-elk
vars: vars:
domain: "elk.{{top_domain}}" domain: "{{domain_elk}}"
http_port: 8008 http_port: 8008
- name: setup mastodon hosts - name: setup mastodon hosts
@ -93,7 +93,8 @@
roles: roles:
- role: docker-mastodon - role: docker-mastodon
vars: vars:
domain: "mastodon.{{top_domain}}" domain: "{{domain_mastodon}}"
domains: "{{ [domain] + domains_mastodon_alternates }}"
http_port: 8009 http_port: 8009
stream_port: 4001 stream_port: 4001
@ -103,7 +104,8 @@
roles: roles:
- role: docker-pixelfed - role: docker-pixelfed
vars: vars:
domain: pixelfed.{{top_domain}} domain: "{{domain_pixelfed}}"
domains: "{{ [domain] + domains_pixelfed }}"
http_port: 8010 http_port: 8010
- name: setup peertube hosts - name: setup peertube hosts
@ -112,7 +114,8 @@
roles: roles:
- role: docker-peertube - role: docker-peertube
vars: vars:
domain: peertube.{{top_domain}} domain: "{{domain_peertube}}"
domains: "{{ [domain] + domains_peertube }}"
http_port: 8011 http_port: 8011
- name: setup bigbluebutton hosts - name: setup bigbluebutton hosts
@ -121,14 +124,15 @@
roles: roles:
- role: docker-bigbluebutton - role: docker-bigbluebutton
vars: vars:
domain: bbb.{{top_domain}} domain: "{{domain_bigbluebutton}}"
- name: setup funkwhale hosts - name: setup funkwhale hosts
hosts: funkwhale hosts: funkwhale
become: true become: true
roles: roles:
- role: docker-funkwhale - role: docker-funkwhale
vars: vars:
domain: funkwhale.{{top_domain}} domain: "{{domain_funkwhale}}"
http_port: 8012 http_port: 8012
- name: setup roulette-wheel hosts - name: setup roulette-wheel hosts
@ -137,7 +141,7 @@
roles: roles:
- role: docker-roulette-wheel - role: docker-roulette-wheel
vars: vars:
domain: roulette.{{top_domain}} domain: "{{domain_roulette}}"
http_port: 8013 http_port: 8013
- name: setup joomla hosts - name: setup joomla hosts
@ -155,7 +159,7 @@
roles: roles:
- role: docker-attendize - role: docker-attendize
vars: vars:
domain: "tickets.{{top_domain}}" domain: "{{domain_attendize}}"
http_port: 8015 http_port: 8015
mail_interface_http_port: 8016 mail_interface_http_port: 8016
@ -165,7 +169,7 @@
roles: roles:
- role: docker-baserow - role: docker-baserow
vars: vars:
domain: baserow.{{top_domain}} domain: "{{domain_baserow}}"
http_port: 8017 http_port: 8017
- name: setup matomo hosts - name: setup matomo hosts
@ -174,7 +178,7 @@
roles: roles:
- role: docker-matomo - role: docker-matomo
vars: vars:
domain: matomo.{{top_domain}} domain: "{{domain_matomo}}"
http_port: 8018 http_port: 8018
- name: setup listmonk - name: setup listmonk
@ -183,7 +187,7 @@
roles: roles:
- role: docker-listmonk - role: docker-listmonk
vars: vars:
domain: listmonk.{{top_domain}} domain: "{{domain_newsletter}}"
http_port: 8019 http_port: 8019
- name: setup discourse - name: setup discourse
@ -192,8 +196,8 @@
roles: roles:
- role: docker-discourse - role: docker-discourse
vars: vars:
domain: forum.{{top_domain}} domain: "{{domain_discourse}}"
domains: "{{discourse_domains}}" domains: "{{domains_discourse}}"
http_port: 8020 http_port: 8020
- name: setup akaunting hosts - name: setup akaunting hosts
@ -202,7 +206,7 @@
roles: roles:
- role: docker-akaunting - role: docker-akaunting
vars: vars:
domain: akaunting.{{top_domain}} domain: "{{domain_akaunting}}"
http_port: 8080 http_port: 8080
# Native Webserver Roles # Native Webserver Roles

View File

@ -0,0 +1,6 @@
- name: "include task certbot-matomo.yml"
include_tasks: certbot-matomo.yml
- name: configure {{domain}}.conf
template: src=templates/mastodon.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf
notify: restart nginx

View File

@ -1,10 +1,9 @@
--- ---
- name: "include task certbot-matomo.yml" - name: "include create-domains.yml"
include_tasks: certbot-matomo.yml include_tasks: create-domains.yml
loop: "{{ domains }}"
- name: configure {{domain}}.conf loop_control:
template: src=templates/mastodon.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf loop_var: domain
notify: restart nginx
- name: "create {{docker_compose_instance_directory}}" - name: "create {{docker_compose_instance_directory}}"
file: file:
@ -20,5 +19,4 @@
template: template:
src: .env.production.j2 src: .env.production.j2
dest: "{{docker_compose_instance_directory}}.env.production" dest: "{{docker_compose_instance_directory}}.env.production"
force: no
notify: recreate mastodon notify: recreate mastodon

View File

@ -1,4 +1,5 @@
LOCAL_DOMAIN={{domain}} LOCAL_DOMAIN={{domain}}
ALTERNATE_DOMAINS="{{ domains_mastodon_alternates | join(',') }}"
SINGLE_USER_MODE={{mastodon_single_user_mode}} SINGLE_USER_MODE={{mastodon_single_user_mode}}
SECRET_KEY_BASE={{mastodon_secret_key_base}} SECRET_KEY_BASE={{mastodon_secret_key_base}}
OTP_SECRET={{mastodon_otp_secret}} OTP_SECRET={{mastodon_otp_secret}}

View File

@ -0,0 +1,6 @@
- name: "include task certbot-matomo.yml"
include_tasks: certbot-matomo.yml
- name: configure {{domain}}.conf
template: src=templates/peertube.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf
notify: restart nginx

View File

@ -1,7 +1,10 @@
--- ---
- name: "include task certbot-matomo.yml" - name: "include create-domains.yml"
include_tasks: certbot-matomo.yml include_tasks: create-domains.yml
loop: "{{ domains }}"
loop_control:
loop_var: domain
- name: "create {{docker_compose_instance_directory}}" - name: "create {{docker_compose_instance_directory}}"
file: file:
path: "{{docker_compose_instance_directory}}" path: "{{docker_compose_instance_directory}}"

View File

@ -1,8 +1,3 @@
upstream backend {
server 127.0.0.1:{{http_port}};
}
server { server {
server_name {{domain}}; server_name {{domain}};
@ -71,7 +66,7 @@ server {
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
proxy_pass http://backend; proxy_pass http://127.0.0.1:{{http_port}};
} }
location /socket.io { location /socket.io {

View File

@ -1,6 +1,9 @@
--- ---
- name: "include tasks nginx-docker-proxy-domain.yml" - name: "include tasks nginx-docker-proxy-domain.yml"
include_tasks: nginx-docker-proxy-domain.yml include_tasks: nginx-docker-proxy-domain.yml
loop: "{{ domains }}"
loop_control:
loop_var: domain
- name: "create {{docker_compose_instance_directory}}" - name: "create {{docker_compose_instance_directory}}"
file: file:

View File

@ -5,18 +5,13 @@
patterns: '*.*.conf' patterns: '*.*.conf'
register: conf_files register: conf_files
- name: Print conf_files domains
debug:
var: conf_files
- name: Filter domain names and remove .conf extension and path - name: Filter domain names and remove .conf extension and path
set_fact: set_fact:
filtered_domains: "{{ conf_files.files | map(attribute='path') | map('regex_search', domain_regex) | select('string') | map('regex_replace', '^/etc/nginx/conf.d/', '') | map('regex_replace', '.conf$', '') | list }}" filtered_domains: "{{ conf_files.files | map(attribute='path') | map('regex_search', domain_regex) | select('string') | map('regex_replace', '^/etc/nginx/conf.d/', '') | map('regex_replace', '.conf$', '') | list }}"
vars: vars:
domain_regex: '^/etc/nginx/conf.d/(?!www\.)[^/]+\.conf$' domain_regex: '^/etc/nginx/conf.d/(?!www\.)[^/]+\.conf$'
- name: The domains for which a www. redirect will be implemented
- name: Print filtered domains
debug: debug:
var: filtered_domains var: filtered_domains