--- - name: Get DKIM key slurp: src: "/etc/dkimkeys/{{ item }}.txt" register: key_file loop: "{{ mail_domains }}" # - name: Show key files # debug: # var: key_file - name: Add DKIM key record for domain synthesio.ovh.domain: endpoint: "{{ ovh_endpoint }}" application_key: "{{ ovh_application_key }}" application_secret: "{{ ovh_application_secret }}" consumer_key: "{{ ovh_consumer_key }}" domain: "{{ item['item'] }}" value: "{{ item['content'] | b64decode | regex_replace('^.*\"(.*)\"$', '\\1') }}" record_type: "DKIM" name: '_domainkey' record_ttl: 10 append: true loop: "{{ key_file['results'] }}" delegate_to: localhost when: - "'.local' not in item['item']" - item['item'] | regex_findall('\.') | length == 1