ansible-role-opendkim_postfix/tasks/configure_ovh.yml

32 lines
1 KiB
YAML
Raw Normal View History

---
- name: Get DKIM key
slurp:
src: "/etc/dkimkeys/{{ item }}.txt"
register: key_file
loop: "{{ mail_domains }}"
2023-09-18 19:11:56 +02:00
- name: Show key files
debug:
2023-09-18 19:31:03 +02:00
msg: "{{ item['content'] | b64decode | regex_replace('^.*\\\"(.*)\\\".*$', '\\1', multiline=True) | regex_replace('[\\s\\n\\t\\\"]*', '', multiline=True)}}"
2023-09-18 19:11:56 +02:00
loop: "{{ key_file['results'] }}"
2023-09-18 19:17:18 +02:00
when:
- "'.local' not in item['item']"
- item['item'] | regex_findall('\.') | length == 1
- name: Add DKIM key record for domain
synthesio.ovh.domain:
2023-09-18 18:43:58 +02:00
endpoint: "{{ ovh_endpoint }}"
application_key: "{{ ovh_application_key }}"
application_secret: "{{ ovh_application_secret }}"
consumer_key: "{{ ovh_consumer_key }}"
2023-09-18 18:24:47 +02:00
domain: "{{ item['item'] }}"
2023-09-18 19:31:03 +02:00
value: "{{ item['content'] | b64decode | regex_replace('^.*\\\"(.*)\\\".*$', '\\1', multiline=True) }}"
2023-09-18 18:03:28 +02:00
record_type: "DKIM"
name: '_domainkey'
record_ttl: 10
append: true
2023-09-18 18:24:47 +02:00
loop: "{{ key_file['results'] }}"
when:
2023-09-18 18:24:47 +02:00
- "'.local' not in item['item']"
- item['item'] | regex_findall('\.') | length == 1