self-hosting/playbook_mailserver.yml

34 lines
947 B
YAML
Raw Normal View History

2024-01-04 19:07:20 +01:00
---
# This is taken from https://workaround.org/ispmail-bookworm/, thanks!
- name: Install mail server
gather_facts: true
2024-01-05 18:36:05 +01:00
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') }}"
2024-01-04 19:07:20 +01:00
roles:
2024-01-05 18:58:27 +01:00
- 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
2024-01-08 09:50:56 +01:00
tags: cert
- role: mailserver_database
tags: database
- role: mailserver_postfix
tags: postfix
2024-01-08 11:58:39 +01:00
- role: mailserver_dovecot
tags: dovecot