--- # This is taken from https://workaround.org/ispmail-bookworm/, thanks! - name: Install mail server gather_facts: true hosts: mailserver,mailserver-test pre_tasks: - name: Get local public IP tags: cert ansible.builtin.uri: url: https://ipinfo.io/ip return_content: true register: local_public_ip - name: Get public IP of "{{ letsencrypt_domain }}" tags: cert ansible.builtin.set_fact: target_public_ip: "{{ lookup('community.general.dig', letsencrypt_domain, '@1.1.1.1') }}" roles: - role: common_handlers tags: always - role: add_cert_http_01 when: local_public_ip == target_public_ip tags: cert - role: add_cert_dns_01 when: local_public_ip != target_public_ip tags: cert - role: mailserver_database tags: database - role: mailserver_postfix tags: postfix - role: mailserver_dovecot tags: dovecot