From 21d03d5b0ba58c37579744a4e7b2f5b9c197f9a1 Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Mon, 18 Sep 2023 19:24:47 +0300 Subject: [PATCH] fix keys and domains --- tasks/configure_ovh.yml | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/tasks/configure_ovh.yml b/tasks/configure_ovh.yml index 55a28bd..b64becc 100644 --- a/tasks/configure_ovh.yml +++ b/tasks/configure_ovh.yml @@ -5,27 +5,19 @@ register: key_file loop: "{{ mail_domains }}" -- name: Show key files - debug: - var: key_file - -- name: Extract key from file content - set_fact: - dkim_key: "{{ key_file['content'] | b64decode | regex_replace('^.*\"(.*)\"$', '\\1') }}" - -- name: Show record content - debug: - var: dkim_key +# - name: Show key files +# debug: +# var: key_file - name: Add DKIM key record for domain synthesio.ovh.domain: - domain: "{{ item }}" - value: "{{ dkim_key }}" + domain: "{{ item['item'] }}" + value: "{{ item['content'] | b64decode | regex_replace('^.*\"(.*)\"$', '\\1') }}" record_type: "DKIM" name: '_domainkey' record_ttl: 10 append: true - loop: "{{ mail_domains }}" + loop: "{{ key_file['results'] }}" when: - - "'.local' not in item" - - item | regex_findall('\.') | length == 1 + - "'.local' not in item['item']" + - item['item'] | regex_findall('\.') | length == 1