mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-03-12 12:42:39 +01:00
Compare commits
12 Commits
b11879650c
...
734d4f8ed3
Author | SHA1 | Date | |
---|---|---|---|
734d4f8ed3 | |||
ccc87ad24b | |||
8e2c8360d4 | |||
b91a132407 | |||
57649698c2 | |||
b8d73f6b09 | |||
83c84f6e86 | |||
30ccd30fa6 | |||
15c5508239 | |||
d2478120ba | |||
b671f9dd05 | |||
4768d66fbb |
@ -1,7 +1,9 @@
|
|||||||
# General
|
# General
|
||||||
pause_duration: "120" # Database delay to wait for the central database before continue tasks
|
pause_duration: "120" # Database delay to wait for the central database before continue tasks
|
||||||
ip4_address: "127.0.0.1" # Change thie in inventory to the ip address of your server
|
|
||||||
backups_folder_path: "/Backups/" # Path to the backups folder
|
backups_folder_path: "/Backups/" # Path to the backups folder
|
||||||
|
timezone: "UTC"
|
||||||
|
locale: "locale"
|
||||||
|
|
||||||
## Domain
|
## Domain
|
||||||
primary_domain_tld: "localhost" # Top Level Domain of the server
|
primary_domain_tld: "localhost" # Top Level Domain of the server
|
||||||
@ -41,4 +43,4 @@ nginx_matomo_tracking: false # Activates matomo tracking on all
|
|||||||
# To enable, update your inventory file.
|
# To enable, update your inventory file.
|
||||||
# For detailed setup instructions, visit:
|
# For detailed setup instructions, visit:
|
||||||
# https://github.com/kevinveenbirkenbach/cymais/tree/master/roles/nginx-docker-cert-deploy
|
# https://github.com/kevinveenbirkenbach/cymais/tree/master/roles/nginx-docker-cert-deploy
|
||||||
enable_one_letsencrypt_cert_for_all: false
|
enable_wildcard_certificate: false
|
||||||
|
@ -5,8 +5,8 @@ nginx:
|
|||||||
directories:
|
directories:
|
||||||
configuration: "/etc/nginx/conf.d/" # Configuration directory
|
configuration: "/etc/nginx/conf.d/" # Configuration directory
|
||||||
http:
|
http:
|
||||||
global: "/etc/nginx/conf.d/http/global" # Contains global configurations which will be loaded into the http block
|
global: "/etc/nginx/conf.d/http/global/" # Contains global configurations which will be loaded into the http block
|
||||||
servers: "/etc/nginx/conf.d/http/servers" # Contains one configuration per domain
|
servers: "/etc/nginx/conf.d/http/servers/" # Contains one configuration per domain
|
||||||
maps: "/etc/nginx/conf.d/http/maps/" # Contains mappings
|
maps: "/etc/nginx/conf.d/http/maps/" # Contains mappings
|
||||||
streams: "/etc/nginx/conf.d/streams/" # Contains streams configuration e.g. for ldaps
|
streams: "/etc/nginx/conf.d/streams/" # Contains streams configuration e.g. for ldaps
|
||||||
well_known: "/usr/share/nginx/well-known/" # Path where well-known files are stored
|
well_known: "/usr/share/nginx/well-known/" # Path where well-known files are stored
|
||||||
|
@ -172,6 +172,10 @@ defaults_applications:
|
|||||||
postgres:
|
postgres:
|
||||||
database.version: "latest"
|
database.version: "latest"
|
||||||
|
|
||||||
|
# Snipe-IT
|
||||||
|
snipe-it:
|
||||||
|
version: "latest"
|
||||||
|
|
||||||
## Taiga
|
## Taiga
|
||||||
taiga:
|
taiga:
|
||||||
version: "latest"
|
version: "latest"
|
||||||
|
@ -44,6 +44,7 @@ ports:
|
|||||||
keycloak: 8032
|
keycloak: 8032
|
||||||
ldap: 8033
|
ldap: 8033
|
||||||
phpmyadmin: 8034
|
phpmyadmin: 8034
|
||||||
|
snipe-it: 8035
|
||||||
bigbluebutton: 48087 # This port is predefined by bbb. @todo Try to change this to a 8XXX port
|
bigbluebutton: 48087 # This port is predefined by bbb. @todo Try to change this to a 8XXX port
|
||||||
# Ports which are exposed to the World Wide Web
|
# Ports which are exposed to the World Wide Web
|
||||||
public:
|
public:
|
||||||
|
10
group_vars/all/10_networks.yml
Normal file
10
group_vars/all/10_networks.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
defaults_networks:
|
||||||
|
internet:
|
||||||
|
ip4: "127.0.0.1" # Change this in inventory to the ip address of your server
|
||||||
|
ip6: "::01" # Change this in inventory to the ip address of your server
|
||||||
|
local:
|
||||||
|
mailu:
|
||||||
|
dns: 192.168.203.254 # Address of the Mailu DNS server
|
||||||
|
subnet: 192.168.203.0/24 # Mailu Subnet
|
||||||
|
|
||||||
|
|
@ -11,6 +11,9 @@
|
|||||||
- name: Merge application definitions
|
- name: Merge application definitions
|
||||||
set_fact:
|
set_fact:
|
||||||
applications: "{{ defaults_applications | combine(applications | default({}, true), recursive=True) }}"
|
applications: "{{ defaults_applications | combine(applications | default({}, true), recursive=True) }}"
|
||||||
|
- name: Merge networks definitions
|
||||||
|
set_fact:
|
||||||
|
networks: "{{ defaults_networks | combine(networks | default({}, true), recursive=True) }}"
|
||||||
|
|
||||||
- name: update device
|
- name: update device
|
||||||
hosts: all
|
hosts: all
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# You should change this to match your reverse proxy DNS name and protocol
|
# You should change this to match your reverse proxy DNS name and protocol
|
||||||
APP_URL=https://{{domain}}
|
APP_URL=https://{{domain}}
|
||||||
LOCALE=en-US
|
LOCALE={{locale}}
|
||||||
|
|
||||||
# Don't change this unless you rename your database container or use rootless podman, in case of using rootless podman you should set it to 127.0.0.1 (NOT localhost)
|
# Don't change this unless you rename your database container or use rootless podman, in case of using rootless podman you should set it to 127.0.0.1 (NOT localhost)
|
||||||
DB_HOST={{database_host}}
|
DB_HOST={{database_host}}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
ENABLE_COTURN=true
|
ENABLE_COTURN=true
|
||||||
COTURN_TLS_CERT_PATH=/etc/letsencrypt/live/{{ primary_domain if enable_one_letsencrypt_cert_for_all else domain }}/fullchain.pem
|
{% set ssl_cert_folder = primary_domain if enable_wildcard_certificate | bool and primary_domain in domain else domain %}
|
||||||
COTURN_TLS_KEY_PATH=/etc/letsencrypt/live/{{ primary_domain if enable_one_letsencrypt_cert_for_all else domain }}/privkey.pem
|
COTURN_TLS_CERT_PATH=/etc/letsencrypt/live/{{ssl_cert_folder}}/fullchain.pem
|
||||||
|
COTURN_TLS_KEY_PATH=/etc/letsencrypt/live/{{ssl_cert_folder}}/privkey.pem
|
||||||
ENABLE_GREENLIGHT={{applications.bigbluebutton.enable_greenlight}}
|
ENABLE_GREENLIGHT={{applications.bigbluebutton.enable_greenlight}}
|
||||||
|
|
||||||
# Enable Webhooks
|
# Enable Webhooks
|
||||||
@ -41,12 +42,12 @@ FSESL_PASSWORD={{bigbluebutton_fsesl_password}}
|
|||||||
|
|
||||||
DOMAIN={{domain}}
|
DOMAIN={{domain}}
|
||||||
|
|
||||||
EXTERNAL_IPv4={{ip4_address}}
|
EXTERNAL_IPv4={{networks.internet.ip4}}
|
||||||
EXTERNAL_IPv6=
|
EXTERNAL_IPv6=
|
||||||
|
|
||||||
# STUN SERVER
|
# STUN SERVER
|
||||||
# stun.freeswitch.org
|
# stun.freeswitch.org
|
||||||
STUN_IP={{ip4_address}}
|
STUN_IP={{networks.internet.ip4}}
|
||||||
STUN_PORT=3478
|
STUN_PORT=3478
|
||||||
|
|
||||||
# TURN SERVER
|
# TURN SERVER
|
||||||
|
@ -34,7 +34,7 @@ env:
|
|||||||
LC_ALL: en_US.UTF-8
|
LC_ALL: en_US.UTF-8
|
||||||
LANG: en_US.UTF-8
|
LANG: en_US.UTF-8
|
||||||
LANGUAGE: en_US.UTF-8
|
LANGUAGE: en_US.UTF-8
|
||||||
# DISCOURSE_DEFAULT_LOCALE: en
|
#DISCOURSE_DEFAULT_LOCALE: {{locale}} # Deactivated because not right format was selected @todo find right format
|
||||||
|
|
||||||
## How many concurrent web requests are supported? Depends on memory and CPU cores.
|
## How many concurrent web requests are supported? Depends on memory and CPU cores.
|
||||||
## will be set automatically by bootstrap based on detected CPUs, or you can override
|
## will be set automatically by bootstrap based on detected CPUs, or you can override
|
||||||
|
@ -14,7 +14,7 @@ services:
|
|||||||
# flag:
|
# flag:
|
||||||
# celery -A funkwhale_api.taskapp worker -l INFO --concurrency=4
|
# celery -A funkwhale_api.taskapp worker -l INFO --concurrency=4
|
||||||
restart: {{docker_restart_policy}}
|
restart: {{docker_restart_policy}}
|
||||||
image: funkwhale/api:${applications.funkwhale.version:-latest}
|
image: funkwhale/api:${FUNKWHALE_VERSION}
|
||||||
env_file: .env
|
env_file: .env
|
||||||
command: celery -A funkwhale_api.taskapp worker -l INFO --concurrency=${CELERYD_CONCURRENCY-0}
|
command: celery -A funkwhale_api.taskapp worker -l INFO --concurrency=${CELERYD_CONCURRENCY-0}
|
||||||
environment:
|
environment:
|
||||||
@ -27,7 +27,7 @@ services:
|
|||||||
|
|
||||||
celerybeat:
|
celerybeat:
|
||||||
restart: {{docker_restart_policy}}
|
restart: {{docker_restart_policy}}
|
||||||
image: funkwhale/api:${applications.funkwhale.version:-latest}
|
image: funkwhale/api:${FUNKWHALE_VERSION}
|
||||||
env_file: .env
|
env_file: .env
|
||||||
command: celery -A funkwhale_api.taskapp beat --pidfile= -l INFO
|
command: celery -A funkwhale_api.taskapp beat --pidfile= -l INFO
|
||||||
{% include 'templates/docker/container/depends-on-database-redis.yml.j2' %}
|
{% include 'templates/docker/container/depends-on-database-redis.yml.j2' %}
|
||||||
@ -35,7 +35,7 @@ services:
|
|||||||
|
|
||||||
api:
|
api:
|
||||||
restart: {{docker_restart_policy}}
|
restart: {{docker_restart_policy}}
|
||||||
image: funkwhale/api:${applications.funkwhale.version:-latest}
|
image: funkwhale/api:${FUNKWHALE_VERSION}
|
||||||
env_file: .env
|
env_file: .env
|
||||||
volumes:
|
volumes:
|
||||||
- "music:${MUSIC_DIRECTORY_PATH}:ro"
|
- "music:${MUSIC_DIRECTORY_PATH}:ro"
|
||||||
@ -48,7 +48,7 @@ services:
|
|||||||
|
|
||||||
front:
|
front:
|
||||||
restart: {{docker_restart_policy}}
|
restart: {{docker_restart_policy}}
|
||||||
image: funkwhale/front:${applications.funkwhale.version:-latest}
|
image: funkwhale/front:${FUNKWHALE_VERSION}
|
||||||
depends_on:
|
depends_on:
|
||||||
- api
|
- api
|
||||||
env_file:
|
env_file:
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
# -----------
|
# -----------
|
||||||
MUSIC_DIRECTORY_PATH=/music
|
MUSIC_DIRECTORY_PATH=/music
|
||||||
|
|
||||||
applications.funkwhale.version={{applications.funkwhale.version}}
|
FUNKWHALE_VERSION={{applications.funkwhale.version}}
|
||||||
|
|
||||||
# End of docker-only configuration
|
# End of docker-only configuration
|
||||||
|
|
||||||
|
@ -57,28 +57,6 @@ The role performs the following main tasks:
|
|||||||
3. **Start Docker containers:**
|
3. **Start Docker containers:**
|
||||||
- The role launches the Keycloak project using Docker Compose.
|
- The role launches the Keycloak project using Docker Compose.
|
||||||
|
|
||||||
## Example: Usage 🚀
|
|
||||||
|
|
||||||
Here is an example of how to use this role in a playbook:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Setup Keycloak with Docker
|
|
||||||
hosts: all
|
|
||||||
vars:
|
|
||||||
domain: "auth.example.com"
|
|
||||||
applications.keycloak.version: "21.1.0"
|
|
||||||
applications.keycloak.administrator_username: "admin"
|
|
||||||
keycloak_administrator_password: "securepassword"
|
|
||||||
database_host: "db.example.com"
|
|
||||||
database_name: "keycloak_db"
|
|
||||||
database_username: "keycloak_user"
|
|
||||||
database_password: "securedbpassword"
|
|
||||||
http_port: 8080
|
|
||||||
docker_restart_policy: "unless-stopped"
|
|
||||||
roles:
|
|
||||||
- docker-keycloak
|
|
||||||
```
|
|
||||||
|
|
||||||
## More Information 📚
|
## More Information 📚
|
||||||
|
|
||||||
For more details about Keycloak, check out:
|
For more details about Keycloak, check out:
|
||||||
|
@ -9,6 +9,6 @@ ldap_localhost_port: 389
|
|||||||
oauth2_proxy_upstream_application_and_port: "{{ applications.ldap.webinterface }}:{% if applications.ldap.webinterface == 'phpldapadmin' %}8080{% else %}80{% endif %}"
|
oauth2_proxy_upstream_application_and_port: "{{ applications.ldap.webinterface }}:{% if applications.ldap.webinterface == 'phpldapadmin' %}8080{% else %}80{% endif %}"
|
||||||
oauth2_proxy_active: true
|
oauth2_proxy_active: true
|
||||||
|
|
||||||
enable_one_letsencrypt_cert_for_all: false # Activate dedicated Certificate
|
enable_wildcard_certificate: false # Activate dedicated Certificate
|
||||||
|
|
||||||
ldap_network_enabled: true # Activate LDAP network
|
ldap_network_enabled: true # Activate LDAP network
|
@ -29,10 +29,10 @@
|
|||||||
dest: "{{docker_compose_instance_directory}}docker-compose.yml"
|
dest: "{{docker_compose_instance_directory}}docker-compose.yml"
|
||||||
notify: docker compose project setup
|
notify: docker compose project setup
|
||||||
|
|
||||||
- name: add mailu.env
|
- name: add .env
|
||||||
template:
|
template:
|
||||||
src: "mailu.env.j2"
|
src: "env.j2"
|
||||||
dest: "{{docker_compose_instance_directory}}mailu.env"
|
dest: "{{docker_compose_instance_directory}}.env"
|
||||||
notify: docker compose project setup
|
notify: docker compose project setup
|
||||||
|
|
||||||
- name: flush docker service
|
- name: flush docker service
|
||||||
|
@ -7,29 +7,29 @@ services:
|
|||||||
# Core services
|
# Core services
|
||||||
resolver:
|
resolver:
|
||||||
image: ghcr.io/mailu/unbound:{{applications.mailu.version}}
|
image: ghcr.io/mailu/unbound:{{applications.mailu.version}}
|
||||||
env_file: mailu.env
|
env_file: .env
|
||||||
restart: {{docker_restart_policy}}
|
restart: {{docker_restart_policy}}
|
||||||
{% include 'templates/docker/container/networks.yml.j2' %}
|
{% include 'templates/docker/container/networks.yml.j2' %}
|
||||||
ipv4_address: 192.168.203.254
|
ipv4_address: {{networks.local.mailu.dns}}
|
||||||
logging:
|
logging:
|
||||||
driver: journald
|
driver: journald
|
||||||
|
|
||||||
front:
|
front:
|
||||||
image: ghcr.io/mailu/nginx:{{applications.mailu.version}}
|
image: ghcr.io/mailu/nginx:{{applications.mailu.version}}
|
||||||
restart: {{docker_restart_policy}}
|
restart: {{docker_restart_policy}}
|
||||||
env_file: mailu.env
|
env_file: .env
|
||||||
logging:
|
logging:
|
||||||
driver: journald
|
driver: journald
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:{{ http_port }}:80"
|
- "127.0.0.1:{{ http_port }}:80"
|
||||||
- "{{ ip4_address }}:25:25"
|
- "{{networks.internet.ip4}}:25:25"
|
||||||
- "{{ ip4_address }}:465:465"
|
- "{{networks.internet.ip4}}:465:465"
|
||||||
- "{{ ip4_address }}:587:587"
|
- "{{networks.internet.ip4}}:587:587"
|
||||||
- "{{ ip4_address }}:110:110"
|
- "{{networks.internet.ip4}}:110:110"
|
||||||
- "{{ ip4_address }}:995:995"
|
- "{{networks.internet.ip4}}:995:995"
|
||||||
- "{{ ip4_address }}:143:143"
|
- "{{networks.internet.ip4}}:143:143"
|
||||||
- "{{ ip4_address }}:993:993"
|
- "{{networks.internet.ip4}}:993:993"
|
||||||
- "{{ ip4_address }}:4190:4190"
|
- "{{networks.internet.ip4}}:4190:4190"
|
||||||
volumes:
|
volumes:
|
||||||
- "/etc/mailu/overrides/nginx:/overrides:ro"
|
- "/etc/mailu/overrides/nginx:/overrides:ro"
|
||||||
- "{{cert_mount_directory}}:/certs:ro"
|
- "{{cert_mount_directory}}:/certs:ro"
|
||||||
@ -40,12 +40,12 @@ services:
|
|||||||
webmail:
|
webmail:
|
||||||
radicale:
|
radicale:
|
||||||
dns:
|
dns:
|
||||||
- 192.168.203.254
|
- {{networks.local.mailu.dns}}
|
||||||
|
|
||||||
admin:
|
admin:
|
||||||
image: ghcr.io/mailu/admin:{{applications.mailu.version}}
|
image: ghcr.io/mailu/admin:{{applications.mailu.version}}
|
||||||
restart: {{docker_restart_policy}}
|
restart: {{docker_restart_policy}}
|
||||||
env_file: mailu.env
|
env_file: .env
|
||||||
volumes:
|
volumes:
|
||||||
- "admin_data:/data"
|
- "admin_data:/data"
|
||||||
- "dkim:/dkim"
|
- "dkim:/dkim"
|
||||||
@ -57,13 +57,13 @@ services:
|
|||||||
logging:
|
logging:
|
||||||
driver: journald
|
driver: journald
|
||||||
dns:
|
dns:
|
||||||
- 192.168.203.254
|
- {{networks.local.mailu.dns}}
|
||||||
{% include 'templates/docker/container/networks.yml.j2' %}
|
{% include 'templates/docker/container/networks.yml.j2' %}
|
||||||
|
|
||||||
imap:
|
imap:
|
||||||
image: ghcr.io/mailu/dovecot:{{applications.mailu.version}}
|
image: ghcr.io/mailu/dovecot:{{applications.mailu.version}}
|
||||||
restart: {{docker_restart_policy}}
|
restart: {{docker_restart_policy}}
|
||||||
env_file: mailu.env
|
env_file: .env
|
||||||
volumes:
|
volumes:
|
||||||
- "dovecot_mail:/mail"
|
- "dovecot_mail:/mail"
|
||||||
- "/etc/mailu/overrides:/overrides:ro"
|
- "/etc/mailu/overrides:/overrides:ro"
|
||||||
@ -71,7 +71,7 @@ services:
|
|||||||
- front
|
- front
|
||||||
- resolver
|
- resolver
|
||||||
dns:
|
dns:
|
||||||
- 192.168.203.254
|
- {{networks.local.mailu.dns}}
|
||||||
logging:
|
logging:
|
||||||
driver: journald
|
driver: journald
|
||||||
{% include 'templates/docker/container/networks.yml.j2' %}
|
{% include 'templates/docker/container/networks.yml.j2' %}
|
||||||
@ -79,7 +79,7 @@ services:
|
|||||||
smtp:
|
smtp:
|
||||||
image: ghcr.io/mailu/postfix:{{applications.mailu.version}}
|
image: ghcr.io/mailu/postfix:{{applications.mailu.version}}
|
||||||
restart: {{docker_restart_policy}}
|
restart: {{docker_restart_policy}}
|
||||||
env_file: mailu.env
|
env_file: .env
|
||||||
volumes:
|
volumes:
|
||||||
- "/etc/mailu/overrides:/overrides:ro"
|
- "/etc/mailu/overrides:/overrides:ro"
|
||||||
- "smtp_queue:/queue"
|
- "smtp_queue:/queue"
|
||||||
@ -87,7 +87,7 @@ services:
|
|||||||
- front
|
- front
|
||||||
- resolver
|
- resolver
|
||||||
dns:
|
dns:
|
||||||
- 192.168.203.254
|
- {{networks.local.mailu.dns}}
|
||||||
logging:
|
logging:
|
||||||
driver: journald
|
driver: journald
|
||||||
{% include 'templates/docker/container/networks.yml.j2' %}
|
{% include 'templates/docker/container/networks.yml.j2' %}
|
||||||
@ -99,14 +99,14 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- resolver
|
- resolver
|
||||||
dns:
|
dns:
|
||||||
- 192.168.203.254
|
- {{networks.local.mailu.dns}}
|
||||||
{% include 'templates/docker/container/networks.yml.j2' %}
|
{% include 'templates/docker/container/networks.yml.j2' %}
|
||||||
noinet:
|
noinet:
|
||||||
|
|
||||||
antispam:
|
antispam:
|
||||||
image: ghcr.io/mailu/rspamd:{{applications.mailu.version}}
|
image: ghcr.io/mailu/rspamd:{{applications.mailu.version}}
|
||||||
restart: {{docker_restart_policy}}
|
restart: {{docker_restart_policy}}
|
||||||
env_file: mailu.env
|
env_file: .env
|
||||||
volumes:
|
volumes:
|
||||||
- "filter:/var/lib/rspamd"
|
- "filter:/var/lib/rspamd"
|
||||||
- "dkim:/dkim"
|
- "dkim:/dkim"
|
||||||
@ -117,7 +117,7 @@ services:
|
|||||||
- antivirus
|
- antivirus
|
||||||
- resolver
|
- resolver
|
||||||
dns:
|
dns:
|
||||||
- 192.168.203.254
|
- {{networks.local.mailu.dns}}
|
||||||
logging:
|
logging:
|
||||||
driver: journald
|
driver: journald
|
||||||
{% include 'templates/docker/container/networks.yml.j2' %}
|
{% include 'templates/docker/container/networks.yml.j2' %}
|
||||||
@ -128,13 +128,13 @@ services:
|
|||||||
antivirus:
|
antivirus:
|
||||||
image: clamav/clamav-debian:latest
|
image: clamav/clamav-debian:latest
|
||||||
restart: {{docker_restart_policy}}
|
restart: {{docker_restart_policy}}
|
||||||
env_file: mailu.env
|
env_file: .env
|
||||||
volumes:
|
volumes:
|
||||||
- "filter:/data"
|
- "filter:/data"
|
||||||
depends_on:
|
depends_on:
|
||||||
- resolver
|
- resolver
|
||||||
dns:
|
dns:
|
||||||
- 192.168.203.254
|
- {{networks.local.mailu.dns}}
|
||||||
logging:
|
logging:
|
||||||
driver: journald
|
driver: journald
|
||||||
{% include 'templates/docker/container/networks.yml.j2' %}
|
{% include 'templates/docker/container/networks.yml.j2' %}
|
||||||
@ -142,7 +142,7 @@ services:
|
|||||||
webdav:
|
webdav:
|
||||||
image: ghcr.io/mailu/radicale:{{applications.mailu.version}}
|
image: ghcr.io/mailu/radicale:{{applications.mailu.version}}
|
||||||
restart: {{docker_restart_policy}}
|
restart: {{docker_restart_policy}}
|
||||||
env_file: mailu.env
|
env_file: .env
|
||||||
volumes:
|
volumes:
|
||||||
- "webdav_data:/data"
|
- "webdav_data:/data"
|
||||||
logging:
|
logging:
|
||||||
@ -150,7 +150,7 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- resolver
|
- resolver
|
||||||
dns:
|
dns:
|
||||||
- 192.168.203.254
|
- {{networks.local.mailu.dns}}
|
||||||
{% include 'templates/docker/container/networks.yml.j2' %}
|
{% include 'templates/docker/container/networks.yml.j2' %}
|
||||||
radicale:
|
radicale:
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- "admin_data:/data"
|
- "admin_data:/data"
|
||||||
restart: {{docker_restart_policy}}
|
restart: {{docker_restart_policy}}
|
||||||
env_file: mailu.env
|
env_file: .env
|
||||||
logging:
|
logging:
|
||||||
driver: journald
|
driver: journald
|
||||||
depends_on:
|
depends_on:
|
||||||
@ -168,13 +168,13 @@ services:
|
|||||||
- imap
|
- imap
|
||||||
- resolver
|
- resolver
|
||||||
dns:
|
dns:
|
||||||
- 192.168.203.254
|
- {{networks.local.mailu.dns}}
|
||||||
{% include 'templates/docker/container/networks.yml.j2' %}
|
{% include 'templates/docker/container/networks.yml.j2' %}
|
||||||
|
|
||||||
webmail:
|
webmail:
|
||||||
image: ghcr.io/mailu/webmail:{{applications.mailu.version}}
|
image: ghcr.io/mailu/webmail:{{applications.mailu.version}}
|
||||||
restart: {{docker_restart_policy}}
|
restart: {{docker_restart_policy}}
|
||||||
env_file: mailu.env
|
env_file: .env
|
||||||
volumes:
|
volumes:
|
||||||
- "webmail_data:/data"
|
- "webmail_data:/data"
|
||||||
- "/etc/mailu/overrides:/overrides:ro"
|
- "/etc/mailu/overrides:/overrides:ro"
|
||||||
@ -185,7 +185,7 @@ services:
|
|||||||
logging:
|
logging:
|
||||||
driver: journald
|
driver: journald
|
||||||
dns:
|
dns:
|
||||||
- 192.168.203.254
|
- {{networks.local.mailu.dns}}
|
||||||
{% include 'templates/docker/container/networks.yml.j2' %}
|
{% include 'templates/docker/container/networks.yml.j2' %}
|
||||||
webmail:
|
webmail:
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ services:
|
|||||||
ipam:
|
ipam:
|
||||||
driver: default
|
driver: default
|
||||||
config:
|
config:
|
||||||
- subnet: {{applications.mailu.subnet}}
|
- subnet: {{networks.local.mailu.subnet}}
|
||||||
radicale:
|
radicale:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
webmail:
|
webmail:
|
||||||
|
@ -15,7 +15,7 @@ LD_PRELOAD=/usr/lib/libhardened_malloc.so
|
|||||||
SECRET_KEY={{mailu_secret_key}}
|
SECRET_KEY={{mailu_secret_key}}
|
||||||
|
|
||||||
# Subnet of the docker network. This should not conflict with any networks to which your system is connected. (Internal and external!)
|
# Subnet of the docker network. This should not conflict with any networks to which your system is connected. (Internal and external!)
|
||||||
SUBNET={{applications.mailu.subnet}}
|
SUBNET={{networks.local.mailu.subnet}}
|
||||||
|
|
||||||
# Main mail domain
|
# Main mail domain
|
||||||
DOMAIN={{applications.mailu.domain}}
|
DOMAIN={{applications.mailu.domain}}
|
@ -1,5 +1,5 @@
|
|||||||
application_id: "mailu"
|
application_id: "mailu"
|
||||||
database_password: "{{mailu_database_password}}"
|
database_password: "{{mailu_database_password}}"
|
||||||
database_type: "mariadb"
|
database_type: "mariadb"
|
||||||
cert_mount_directory: "{{docker_compose_instance_directory}}/certs/"
|
cert_mount_directory: "{{docker_compose_instance_directory}}/certs/"
|
||||||
enable_one_letsencrypt_cert_for_all: false
|
enable_wildcard_certificate: false
|
@ -1,7 +1,7 @@
|
|||||||
matrix_servers:
|
matrix_servers:
|
||||||
hosts:
|
hosts:
|
||||||
{{inventory_hostname}}:
|
{{inventory_hostname}}:
|
||||||
ansible_host: "{{ip4_address}}"
|
ansible_host: "{{networks.internet.ip4}}"
|
||||||
ansible_ssh_user: administrator
|
ansible_ssh_user: administrator
|
||||||
become: true
|
become: true
|
||||||
become_user: root
|
become_user: root
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
src: "templates/nginx.conf.j2"
|
src: "templates/nginx.conf.j2"
|
||||||
dest: "{{nginx.directories.http.servers}}{{domains.matrix_synapse}}.conf"
|
dest: "{{nginx.directories.http.servers}}{{domains.matrix_synapse}}.conf"
|
||||||
vars:
|
vars:
|
||||||
domain: "{{domains.matrix_synapse}}"
|
# domain: "{{domains.matrix_synapse}}" This does not seem to work @todo Check how to solve without declaring set_fact, seems a bug at templates
|
||||||
http_port: "{{ports.localhost.http_ports.matrix_synapse}}"
|
http_port: "{{ports.localhost.http_ports.matrix_synapse}}"
|
||||||
notify: restart nginx
|
notify: restart nginx
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
server {
|
server {
|
||||||
|
# Somehow .j2 doesn't interpretate the passed variable right. For this reasons this redeclaration is necessary
|
||||||
|
{% set domain = domains.matrix_synapse %}
|
||||||
|
|
||||||
server_name {{domain}};
|
server_name {{domain}};
|
||||||
{% include 'roles/letsencrypt/templates/ssl_header.j2' %}
|
{% include 'roles/letsencrypt/templates/ssl_header.j2' %}
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ ENFORCE_EMAIL_VERIFICATION=false
|
|||||||
PF_MAX_USERS=1000
|
PF_MAX_USERS=1000
|
||||||
OAUTH_ENABLED=true
|
OAUTH_ENABLED=true
|
||||||
|
|
||||||
APP_TIMEZONE=UTC
|
APP_TIMEZONE={{timezone}}
|
||||||
APP_LOCALE=en
|
APP_LOCALE={{locale}}
|
||||||
|
|
||||||
## Pixelfed Tweaks
|
## Pixelfed Tweaks
|
||||||
LIMIT_ACCOUNT_SIZE=true
|
LIMIT_ACCOUNT_SIZE=true
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
volumes:
|
|
||||||
db_data:
|
|
||||||
storage:
|
|
||||||
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
image: snipe/snipe-it:${APP_VERSION}
|
|
||||||
restart: unless-stopped
|
|
||||||
volumes:
|
|
||||||
- storage:/var/lib/snipeit
|
|
||||||
ports:
|
|
||||||
- "${APP_PORT:-8000}:80"
|
|
||||||
depends_on:
|
|
||||||
db:
|
|
||||||
condition: service_healthy
|
|
||||||
restart: true
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
26
roles/docker-snipe-it/templates/docker-compose.yml.j2
Normal file
26
roles/docker-snipe-it/templates/docker-compose.yml.j2
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
volumes:
|
||||||
|
db_data:
|
||||||
|
storage:
|
||||||
|
|
||||||
|
{% include 'templates/docker/services/redis.yml.j2' %}
|
||||||
|
|
||||||
|
{% include 'templates/docker/services/' + database_type + '.yml.j2' %}
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: snipe/snipe-it:${APP_VERSION}
|
||||||
|
restart: {{docker_restart_policy}}
|
||||||
|
volumes:
|
||||||
|
- data:/var/lib/snipeit
|
||||||
|
ports:
|
||||||
|
- "${APP_PORT}:80"
|
||||||
|
{% include 'templates/docker/container/depends-on-database-redis.yml.j2' %}
|
||||||
|
env_file:
|
||||||
|
- .env # Will also be read, without this parameter
|
||||||
|
{% include 'templates/docker/container/networks.yml.j2' %}
|
||||||
|
|
||||||
|
{% include 'templates/docker/compose/volumes.yml.j2' %}
|
||||||
|
redis:
|
||||||
|
data:
|
||||||
|
|
||||||
|
{% include 'templates/docker/compose/networks.yml.j2' %}
|
@ -1,8 +1,8 @@
|
|||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# REQUIRED: DOCKER SPECIFIC SETTINGS
|
# REQUIRED: DOCKER SPECIFIC SETTINGS
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
APP_VERSION=
|
APP_VERSION={{applications.snape-it.version}}
|
||||||
APP_PORT=8000
|
APP_PORT={{ports.localhost.http_ports.snipe-it}}
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# REQUIRED: BASIC APP SETTINGS
|
# REQUIRED: BASIC APP SETTINGS
|
||||||
@ -11,10 +11,10 @@ APP_ENV=production
|
|||||||
APP_DEBUG=false
|
APP_DEBUG=false
|
||||||
# Please regenerate the APP_KEY value by calling `docker compose run --rm app php artisan key:generate --show`. Copy paste the value here
|
# Please regenerate the APP_KEY value by calling `docker compose run --rm app php artisan key:generate --show`. Copy paste the value here
|
||||||
APP_KEY=base64:3ilviXqB9u6DX1NRcyWGJ+sjySF+H18CPDGb3+IVwMQ=
|
APP_KEY=base64:3ilviXqB9u6DX1NRcyWGJ+sjySF+H18CPDGb3+IVwMQ=
|
||||||
APP_URL=http://localhost:8000
|
APP_URL=https://{{domain}}
|
||||||
# https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - TZ identifier
|
# https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - TZ identifier
|
||||||
APP_TIMEZONE='UTC'
|
APP_TIMEZONE='{{timezone}}'
|
||||||
APP_LOCALE=en-US
|
APP_LOCALE={{locale}}
|
||||||
MAX_RESULTS=500
|
MAX_RESULTS=500
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
@ -27,16 +27,16 @@ PUBLIC_FILESYSTEM_DISK=local_public
|
|||||||
# REQUIRED: DATABASE SETTINGS
|
# REQUIRED: DATABASE SETTINGS
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
DB_CONNECTION=mysql
|
DB_CONNECTION=mysql
|
||||||
DB_HOST=db
|
DB_HOST={{database_host}}
|
||||||
DB_PORT='3306'
|
DB_PORT={{database_port}}
|
||||||
DB_DATABASE=snipeit
|
DB_DATABASE={{database_name}}
|
||||||
DB_USERNAME=snipeit
|
DB_USERNAME={{database_username}}
|
||||||
DB_PASSWORD=changeme1234
|
DB_PASSWORD={{pixelfed_database_password}}
|
||||||
MYSQL_ROOT_PASSWORD=changeme1234
|
#MYSQL_ROOT_PASSWORD=
|
||||||
DB_PREFIX=null
|
#DB_PREFIX=null
|
||||||
DB_DUMP_PATH='/usr/bin'
|
#DB_DUMP_PATH='/usr/bin'
|
||||||
DB_CHARSET=utf8mb4
|
#DB_CHARSET=utf8mb4
|
||||||
DB_COLLATION=utf8mb4_unicode_ci
|
#DB_COLLATION=utf8mb4_unicode_ci
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# OPTIONAL: SSL DATABASE SETTINGS
|
# OPTIONAL: SSL DATABASE SETTINGS
|
||||||
@ -52,17 +52,17 @@ DB_SSL_VERIFY_SERVER=null
|
|||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# REQUIRED: OUTGOING MAIL SERVER SETTINGS
|
# REQUIRED: OUTGOING MAIL SERVER SETTINGS
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
MAIL_MAILER=smtp
|
MAIL_MAILER = smtp
|
||||||
MAIL_HOST=mailhog
|
MAIL_HOST = {{system_email.host}} # SMTP server address
|
||||||
MAIL_PORT=1025
|
MAIL_PORT = {{system_email.host}} # SMTP server address
|
||||||
MAIL_USERNAME=null
|
MAIL_USERNAME = {{system_email.username}} # user to connect the SMTP server
|
||||||
MAIL_PASSWORD=null
|
MAIL_PASSWORD = {{system_email.password}} # SMTP user's password
|
||||||
MAIL_TLS_VERIFY_PEER=true
|
MAIL_TLS_VERIFY_PEER = EMAIL_USE_TLS={{ system_email.tls | lower | capitalize }} # use TLS (secure) connection with the SMTP server
|
||||||
MAIL_FROM_ADDR=you@example.com
|
MAIL_FROM_ADDR = {{system_email.from}} # default email address for the automated emails
|
||||||
MAIL_FROM_NAME='Snipe-IT'
|
MAIL_FROM_NAME = 'Snipe-IT'
|
||||||
MAIL_REPLYTO_ADDR=you@example.com
|
MAIL_REPLYTO_ADDR = {{system_email.from}} # default email address for the automated emails
|
||||||
MAIL_REPLYTO_NAME='Snipe-IT'
|
MAIL_REPLYTO_NAME = 'Snipe-IT'
|
||||||
MAIL_AUTO_EMBED_METHOD='attachment'
|
MAIL_AUTO_EMBED_METHOD = 'attachment'
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# REQUIRED: DATA PROTECTION
|
# REQUIRED: DATA PROTECTION
|
||||||
@ -97,12 +97,12 @@ API_TOKEN_EXPIRATION_YEARS=40
|
|||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# OPTIONAL: SECURITY HEADER SETTINGS
|
# OPTIONAL: SECURITY HEADER SETTINGS
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1,172.16.0.0/12
|
APP_TRUSTED_PROXIES=172.17.0.1 # Docker Gateway
|
||||||
ALLOW_IFRAMING=false
|
ALLOW_IFRAMING=false
|
||||||
REFERRER_POLICY=same-origin
|
REFERRER_POLICY=same-origin
|
||||||
ENABLE_CSP=false
|
ENABLE_CSP=true
|
||||||
CORS_ALLOWED_ORIGINS=null
|
CORS_ALLOWED_ORIGINS=null
|
||||||
ENABLE_HSTS=false
|
ENABLE_HSTS=false # Certificates managed by nginx
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# OPTIONAL: CACHE SETTINGS
|
# OPTIONAL: CACHE SETTINGS
|
||||||
@ -115,7 +115,7 @@ CACHE_PREFIX=snipeit
|
|||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# OPTIONAL: REDIS SETTINGS
|
# OPTIONAL: REDIS SETTINGS
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
REDIS_HOST=null
|
REDIS_HOST=redis
|
||||||
REDIS_PASSWORD=null
|
REDIS_PASSWORD=null
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
{% set ssl_cert_folder = primary_domain if enable_one_letsencrypt_cert_for_all else domain %}
|
{% set ssl_cert_folder = primary_domain if enable_wildcard_certificate | bool and primary_domain in domain else domain %}
|
||||||
ssl_certificate /etc/letsencrypt/live/{{ ssl_cert_folder }}/fullchain.pem;
|
ssl_certificate /etc/letsencrypt/live/{{ ssl_cert_folder }}/fullchain.pem;
|
||||||
ssl_certificate_key /etc/letsencrypt/live/{{ ssl_cert_folder }}/privkey.pem;
|
ssl_certificate_key /etc/letsencrypt/live/{{ ssl_cert_folder }}/privkey.pem;
|
||||||
ssl_trusted_certificate /etc/letsencrypt/live/{{ ssl_cert_folder }}/chain.pem;
|
ssl_trusted_certificate /etc/letsencrypt/live/{{ ssl_cert_folder }}/chain.pem;
|
@ -23,7 +23,7 @@ This Ansible role simplifies the deployment of **Let's Encrypt certificates** in
|
|||||||
By default, each subdomain gets its own certificate. You can **enable a wildcard certificate** by setting:
|
By default, each subdomain gets its own certificate. You can **enable a wildcard certificate** by setting:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
enable_one_letsencrypt_cert_for_all: true
|
enable_wildcard_certificate: true
|
||||||
```
|
```
|
||||||
|
|
||||||
📌 **Pros & Cons of a Wildcard Certificate:**
|
📌 **Pros & Cons of a Wildcard Certificate:**
|
||||||
@ -58,7 +58,7 @@ If enabled, update your inventory file and follow the **manual wildcard certific
|
|||||||
---
|
---
|
||||||
|
|
||||||
## **🔐 Wildcard Certificate Setup with Let's Encrypt**
|
## **🔐 Wildcard Certificate Setup with Let's Encrypt**
|
||||||
If you enabled `enable_one_letsencrypt_cert_for_all`, follow these steps to manually request a **wildcard certificate**.
|
If you enabled `enable_wildcard_certificate`, follow these steps to manually request a **wildcard certificate**.
|
||||||
|
|
||||||
### **1️⃣ Run the Certbot Command 🖥️**
|
### **1️⃣ Run the Certbot Command 🖥️**
|
||||||
```sh
|
```sh
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Deactivate CSP header
|
# Deactivate CSP header
|
||||||
more_set_headers "Content-Security-Policy: ";
|
add_header Content-Security-Policy: "";
|
||||||
|
|
||||||
# sub filters to integrate matomo tracking code in nginx websites
|
# sub filters to integrate matomo tracking code in nginx websites
|
||||||
sub_filter '</head>' '<script>{{matomo_tracking_code_one_liner}}</script></head>';
|
sub_filter '</head>' '<script>{{matomo_tracking_code_one_liner}}</script></head>';
|
||||||
|
2
roles/nginx-www-redirect/meta/main.yml
Normal file
2
roles/nginx-www-redirect/meta/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
dependencies:
|
||||||
|
- nginx
|
@ -5,6 +5,8 @@
|
|||||||
patterns: '*.*.conf'
|
patterns: '*.*.conf'
|
||||||
register: conf_files
|
register: conf_files
|
||||||
|
|
||||||
|
# Filter all domains
|
||||||
|
|
||||||
- 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', path_regex, '') | map('regex_replace', '.conf$', '') | list }}"
|
filtered_domains: "{{ conf_files.files | map(attribute='path') | map('regex_search', domain_regex) | select('string') | map('regex_replace', path_regex, '') | map('regex_replace', '.conf$', '') | list }}"
|
||||||
@ -15,9 +17,69 @@
|
|||||||
- name: The domains for which a www. redirect will be implemented
|
- name: The domains for which a www. redirect will be implemented
|
||||||
debug:
|
debug:
|
||||||
var: filtered_domains
|
var: filtered_domains
|
||||||
|
when: mode_debug | bool
|
||||||
|
|
||||||
- name: Include nginx-domain-redirect role with dynamic domain mappings
|
# Routine for domains with primary domain included
|
||||||
|
|
||||||
|
- name: Set filtered_domains_with_primary_domain
|
||||||
|
set_fact:
|
||||||
|
filtered_domains_with_primary_domain: "{{ filtered_domains | select('search', primary_domain + '$') | list }}"
|
||||||
|
|
||||||
|
- name: Debug with primary domain
|
||||||
|
debug:
|
||||||
|
var: filtered_domains_with_primary_domain
|
||||||
|
when: mode_debug | bool
|
||||||
|
|
||||||
|
- name: Include nginx-domain-redirect role with dynamic domain mappings for domains with {{primary_domain}} included
|
||||||
include_role:
|
include_role:
|
||||||
name: nginx-domain-redirect
|
name: nginx-domain-redirect
|
||||||
vars:
|
vars:
|
||||||
domain_mappings: "{{ filtered_domains | map('regex_replace', '^(.*)$', '{ source: \"www.\\1\", target: \"\\1\" }') | map('from_yaml') | list }}"
|
domain_mappings: "{{ filtered_domains_with_primary_domain | map('regex_replace', '^(.*)$', '{ source: \"www.\\1\", target: \"\\1\" }') | map('from_yaml') | list }}"
|
||||||
|
when: not enable_wildcard_certificate | bool
|
||||||
|
|
||||||
|
- name: Include wildcard www. redirect for domains with {{primary_domain}} included
|
||||||
|
vars:
|
||||||
|
domain: "{{primary_domain}}"
|
||||||
|
template:
|
||||||
|
src: www.wildcard.conf.j2
|
||||||
|
dest: "{{nginx_www_wildcart_configuration}}"
|
||||||
|
notify: restart nginx
|
||||||
|
when: enable_wildcard_certificate | bool
|
||||||
|
|
||||||
|
# Routine for domains without the primary domain included
|
||||||
|
|
||||||
|
- name: Set filtered_domains_without_primary_domain
|
||||||
|
set_fact:
|
||||||
|
filtered_domains_without_primary_domain: "{{ filtered_domains | reject('search', primary_domain + '$') | list }}"
|
||||||
|
|
||||||
|
- name: Debug domains without primary domain
|
||||||
|
debug:
|
||||||
|
var: filtered_domains_without_primary_domain
|
||||||
|
when: mode_debug | bool
|
||||||
|
|
||||||
|
- name: Include nginx-domain-redirect role with dynamic domain mappings for domains without primary domain
|
||||||
|
include_role:
|
||||||
|
name: nginx-domain-redirect
|
||||||
|
vars:
|
||||||
|
domain_mappings: "{{ filtered_domains_without_primary_domain | map('regex_replace', '^(.*)$', '{ source: \"www.\\1\", target: \"\\1\" }') | map('from_yaml') | list }}"
|
||||||
|
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
- name: Cleanup dedicated nginx configurations for www redirect configuration
|
||||||
|
file:
|
||||||
|
path: "{{ nginx.directories.http.servers }}{{ item.source }}.conf"
|
||||||
|
state: absent
|
||||||
|
loop: "{{ filtered_domains_with_primary_domain | map('regex_replace', '^(.*)$', '{ source: \"www.\\1\", target: \"\\1\" }') | map('from_yaml') | list }}"
|
||||||
|
notify: restart nginx
|
||||||
|
when:
|
||||||
|
- enable_wildcard_certificate | bool
|
||||||
|
- mode_cleanup
|
||||||
|
|
||||||
|
- name: Cleanup {{nginx_www_wildcart_configuration}}
|
||||||
|
file:
|
||||||
|
path: "{{nginx_www_wildcart_configuration}}"
|
||||||
|
state: absent
|
||||||
|
notify: restart nginx
|
||||||
|
when:
|
||||||
|
- not enable_wildcard_certificate | bool
|
||||||
|
- mode_cleanup
|
||||||
|
6
roles/nginx-www-redirect/templates/www.wildcard.conf.j2
Normal file
6
roles/nginx-www-redirect/templates/www.wildcard.conf.j2
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
server {
|
||||||
|
server_name ~^www\.(?<domain>.+)$;
|
||||||
|
{% include 'roles/letsencrypt/templates/ssl_header.j2' %}
|
||||||
|
|
||||||
|
return 301 https://$domain$request_uri;
|
||||||
|
}
|
1
roles/nginx-www-redirect/vars/main.yml
Normal file
1
roles/nginx-www-redirect/vars/main.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
nginx_www_wildcart_configuration: "{{nginx.directories.http.global}}www.wildcard.conf"
|
@ -23,7 +23,7 @@
|
|||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
recurse: yes
|
recurse: yes
|
||||||
loop: "{{ nginx.directories.http + nginx.directories.streams }}"
|
loop: "{{ nginx.directories.http.values() | list + [nginx.directories.streams] }}"
|
||||||
when: run_once_nginx is not defined
|
when: run_once_nginx is not defined
|
||||||
|
|
||||||
- name: create nginx config file
|
- name: create nginx config file
|
||||||
|
@ -34,8 +34,9 @@ http
|
|||||||
gzip_types application/atom+xml application/javascript application/xml+rss application/x-javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy text/javascript text/xml;
|
gzip_types application/atom+xml application/javascript application/xml+rss application/x-javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy text/javascript text/xml;
|
||||||
|
|
||||||
types_hash_max_size 4096;
|
types_hash_max_size 4096;
|
||||||
include {{nginx.directories.http.maps}}*.conf;
|
{% for dir in nginx.directories.http.values() %}
|
||||||
include {{nginx.directories.http.servers}}*.conf;
|
include {{ dir }}*.conf;
|
||||||
|
{% endfor %}
|
||||||
}
|
}
|
||||||
|
|
||||||
# For port proxies
|
# For port proxies
|
||||||
|
@ -3,21 +3,25 @@
|
|||||||
certbot certonly --agree-tos --email {{ administrator_email }}
|
certbot certonly --agree-tos --email {{ administrator_email }}
|
||||||
--non-interactive --webroot -w /var/lib/letsencrypt/ -d {{ domain }}
|
--non-interactive --webroot -w /var/lib/letsencrypt/ -d {{ domain }}
|
||||||
{{ '--test-cert' if mode_test | bool else '' }}
|
{{ '--test-cert' if mode_test | bool else '' }}
|
||||||
when: not enable_one_letsencrypt_cert_for_all
|
when: not enable_wildcard_certificate | bool or primary_domain not in domain
|
||||||
|
|
||||||
- name: "recieve certbot certificate for *{{ primary_domain }}"
|
- name: "recieve certbot certificate for *{{ primary_domain }}"
|
||||||
command: >-
|
command: >-
|
||||||
certbot certonly --agree-tos --email {{ administrator_email }}
|
certbot certonly --agree-tos --email {{ administrator_email }}
|
||||||
--non-interactive --webroot -w /var/lib/letsencrypt/ -d {{ primary_domain }} -d *.{{ primary_domain }}
|
--non-interactive --webroot -w /var/lib/letsencrypt/ -d {{ primary_domain }} -d *.{{ primary_domain }}
|
||||||
{{ '--test-cert' if mode_test | bool else '' }}
|
{{ '--test-cert' if mode_test | bool else '' }}
|
||||||
when: enable_one_letsencrypt_cert_for_all and run_once_recieve_certificate is not defined
|
when:
|
||||||
|
- enable_wildcard_certificate | bool
|
||||||
|
- primary_domain in domain
|
||||||
|
- run_once_recieve_certificate is not defined
|
||||||
|
|
||||||
- name: "Cleanup dedicated cert for {{ domain }}"
|
- name: "Cleanup dedicated cert for {{ domain }}"
|
||||||
command: >-
|
command: >-
|
||||||
certbot delete --cert-name {{ domain }} --non-interactive
|
certbot delete --cert-name {{ domain }} --non-interactive
|
||||||
when:
|
when:
|
||||||
- mode_cleanup
|
- mode_cleanup | bool
|
||||||
- enable_one_letsencrypt_cert_for_all
|
- enable_wildcard_certificate | bool
|
||||||
|
- primary_domain in domain
|
||||||
- domain != primary_domain
|
- domain != primary_domain
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user