Commit 0f6847b5 authored by Chris Croome's avatar Chris Croome
Browse files

check sub-domains and add to config file

parent a49e49ce
......@@ -164,6 +164,61 @@
- name: Generate random database root
command: pwgen -n 28 1
register: dbroot
- name: Check the server IP address
command: hostname -i
register: hostname_ip
- debug:
msg: "The results of `hostname -i`: {{ hostname_ip.stdout }}"
- name: Check the IP address of {{ hostname }}
command: dig @8.8.8.8 {{ hostname }} +short
register: hostname_dig_ip
- debug:
msg: "The results of `dig @8.8.8.8 {{ hostname }} +short`: {{ hostname_dig_ip.stdout }}"
- name: Fail if {{ hostname }} doesn't resolve to {{ hostname_ip.stdout }}
fail:
msg: "The hostname, {{ hostname }} needs to resolve to the server ip address, {{ hostname_ip.stdout }}"
when: hostname_dig_ip.stdout != hostname_ip.stdout
- name: Check the IP address of www.{{ hostname }}
command: dig @8.8.8.8 www.{{ hostname }} +short
register: www_hostname_dig_ip
- debug:
msg: "The results of `dig @8.8.8.8 www.{{ hostname }} +short`: {{ www_hostname_dig_ip.stdout }}"
- name: Fail if www.{{ hostname }} doesn't resolve to {{ hostname_ip.stdout }}
fail:
msg: "The hostname, www.{{ hostname }} needs to resolve to the server ip address, {{ hostname_ip.stdout }}"
when: www_hostname_dig_ip.stdout != hostname_ip.stdout
- name: Check the IP address of autodiscover.{{ hostname }}
command: dig @8.8.8.8 autodiscover.{{ hostname }} +short
register: autodiscover_hostname_dig_ip
- debug:
msg: "The results of `dig @8.8.8.8 autodiscover.{{ hostname }} +short`: {{ autodiscover_hostname_dig_ip.stdout }}"
- name: Fail if autodiscover.{{ hostname }} doesn't resolve to {{ hostname_ip.stdout }}
fail:
msg: "The hostname, autodiscover.{{ hostname }} needs to resolve to the server ip address, {{ hostname_ip.stdout }}"
when: autodiscover_hostname_dig_ip.stdout != hostname_ip.stdout
- name: Check the IP address of autoconfig.{{ hostname }}
command: dig @8.8.8.8 autoconfig.{{ hostname }} +short
register: autoconfig_hostname_dig_ip
- debug:
msg: "The results of `dig @8.8.8.8 autoconfig.{{ hostname }} +short`: {{ autoconfig_hostname_dig_ip.stdout }}"
- name: Fail if autoconfig.{{ hostname }} doesn't resolve to {{ hostname_ip.stdout }}
fail:
msg: "The hostname, autodiscover.{{ hostname }} needs to resolve to the server ip address, {{ hostname_ip.stdout }}"
when: autoconfig_hostname_dig_ip.stdout != hostname_ip.stdout
- name: Generate /var/mailcow/mailcow.conf
template:
......
......@@ -50,7 +50,7 @@ TZ={{ timezone.stdout }}
COMPOSE_PROJECT_NAME=mailcow-dockerized
# Additional SAN for the certificate
ADDITIONAL_SAN=
ADDITIONAL_SAN=www.{{ hostname }},autoconfig.{{ hostname ]],autodiscover.{{ hostname }}
# To never run acme-mailcow for Let's Encrypt, set this to y
SKIP_LETS_ENCRYPT=n
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment