ansible-role-opendkim_postfix/tasks/configure_ovh.yml

29 lines
790 B
YAML
Raw Normal View History

---
- name: Get DKIM key
slurp:
src: "/etc/dkimkeys/{{ item }}.txt"
register: key_file
loop: "{{ mail_domains }}"
2023-09-18 18:24:47 +02:00
# - name: Show key files
# debug:
# var: key_file
- 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'] }}"
value: "{{ item['content'] | b64decode | regex_replace('^.*\"(.*)\"$', '\\1') }}"
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'] }}"
2023-09-18 18:50:55 +02:00
delegate_to: localhost
when:
2023-09-18 18:24:47 +02:00
- "'.local' not in item['item']"
- item['item'] | regex_findall('\.') | length == 1