summaryrefslogtreecommitdiff
path: root/ansible
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-08-03 17:54:57 +0100
committerJoe Carstairs <me@joeac.net>2026-08-03 17:54:57 +0100
commitf61d649de766f5b86ad4815a423f3ac5b086297d (patch)
tree1685a44dbeb8abc350068334e70c5f6e84bd7f8d /ansible
parent66ba9847e9fd90daf7f59f75f57db0cc1615f04d (diff)
hard-codes subdomain full domain in ansible vars
Diffstat (limited to 'ansible')
-rw-r--r--ansible/roles/mox/templates/domains.conf8
-rw-r--r--ansible/roles/tls/tasks/main.yml8
-rw-r--r--ansible/vars/common.yml9
3 files changed, 17 insertions, 8 deletions
diff --git a/ansible/roles/mox/templates/domains.conf b/ansible/roles/mox/templates/domains.conf
index e3ef95c..2aea5b9 100644
--- a/ansible/roles/mox/templates/domains.conf
+++ b/ansible/roles/mox/templates/domains.conf
@@ -61,7 +61,7 @@ WebHandlers:
LogName: {{ subdomain.name }}.joeac.net
PathRegexp: ^/
Compress: true
- Domain: {% if subdomain.name == "@" %}joeac.net{% else %}{{ subdomain.name }}.joeac.net{% endif %}
+ Domain: {{ subdomain.full_domain }}
WebStatic:
Root: {{ services[subdomain.service].root }}
ListFiles: {{ "directory_listing" in services[subdomain.service] and services[subdomain.service].directory_listing }}
@@ -71,7 +71,7 @@ WebHandlers:
LogName: {{ subdomain.name }}.joeac.net
PathRegexp: ^.*[^(.html)]$
Compress: true
- Domain: {% if subdomain.name == "@" %}joeac.net{% else %}{{ subdomain.name }}.joeac.net{% endif %}
+ Domain: {{ subdomain.full_domain }}
WebRedirect:
OrigPathRegexp: ^(.*[^(.html)])$
ReplacePath: $1/index.html
@@ -80,7 +80,7 @@ WebHandlers:
LogName: {{ subdomain.name }}.joeac.net
PathRegexp: ^/.*/index.html$
Compress: true
- Domain: {% if subdomain.name == "@" %}joeac.net{% else %}{{ subdomain.name }}.joeac.net{% endif %}
+ Domain: {{ subdomain.full_domain }}
WebRedirect:
OrigPathRegexp: ^(.*)/index.html$
ReplacePath: $1.html
@@ -90,7 +90,7 @@ WebHandlers:
LogName: {{ subdomain.name }}.joeac.net
PathRegexp: ^/
Compress: true
- Domain: {% if subdomain.name == "@" %}joeac.net{% else %}{{ subdomain.name }}.joeac.net{% endif %}
+ Domain: {{ subdomain.full_domain }}
WebForward:
URL: http://{{ hostvars[services[subdomain.service].host].ansible_host }}:{{ services[subdomain.service].port }}
{% endif %}
diff --git a/ansible/roles/tls/tasks/main.yml b/ansible/roles/tls/tasks/main.yml
index e758fc5..195a391 100644
--- a/ansible/roles/tls/tasks/main.yml
+++ b/ansible/roles/tls/tasks/main.yml
@@ -29,13 +29,13 @@
certbot renew --non-interactive
- name: Install missing TLS certificates
- loop: "{{ subdomains | map(attribute='name') }}"
- when: not ( ( item ~ ".joeac.net" ) in ansible_local.certbot.certificates )
+ loop: "{{ subdomains }}"
+ when: not ( ( item.name ~ ".joeac.net" ) in ansible_local.certbot.certificates )
ansible.builtin.shell:
certbot certonly \
--nginx \
- --cert-name {{ item }}.joeac.net \
- --domain {% if item == "@" %} joeac.net {% else %} {{ item }}.joeac.net {% endif %} \
+ --cert-name {{ item.name }}.joeac.net \
+ --domain {{ subdomain.full_domain }} \
--non-interactive
- name: Add joeac.net group
diff --git a/ansible/vars/common.yml b/ansible/vars/common.yml
index c21cb61..e50f6e7 100644
--- a/ansible/vars/common.yml
+++ b/ansible/vars/common.yml
@@ -20,25 +20,34 @@ services:
subdomains:
- name: "@"
+ full_domain: joeac.net
mox_handler: forward
service: http
- name: budget
+ full_domain: budget.joeac.net
mox_handler: forward
service: actualbudget
- name: docs
+ full_domain: docs.joeac.net
mox_handler: forward
service: etherpad
- name: ln
+ full_domain: ln.joeac.net
mox_handler: static
service: ln
- name: mail
+ full_domain: mail.joeac.net
mox_handler: none
- name: autoconfig.mail
+ full_domain: autoconfig.mail.joeac.net
mox_handler: none
- name: clientsettings.mail
+ full_domain: clientsettings.mail.joeac.net
mox_handler: none
- name: mta-sts.mail
+ full_domain: mta-sts.mail.joeac.net
mox_handler: none
- name: pwd
+ full_domain: pwd.joeac.net
mox_handler: forward
service: vaultwarden