From 3cfcf9ddc24d256ffc79e9c2f21ed280a78463fe Mon Sep 17 00:00:00 2001 From: Klaus Zerwes Date: Mon, 9 Mar 2020 20:51:05 +0100 Subject: [PATCH] allow adding apt_key's from a file on the ansible server --- tasks/repo-Debian.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tasks/repo-Debian.yml b/tasks/repo-Debian.yml index 24f28e7..d2f6731 100644 --- a/tasks/repo-Debian.yml +++ b/tasks/repo-Debian.yml @@ -5,11 +5,20 @@ name: gnupg state: present -- name: Import the PowerDNS APT Repository key +- name: Import the PowerDNS APT Repository key from URL apt_key: url: "{{ pdns_install_repo['gpg_key'] }}" id: "{{ pdns_install_repo['gpg_key_id'] | default('') }}" state: present + when: pdns_install_repo['gpg_key'] is regex("^[a-z]{3,}://") + register: _pdns_apt_key + +- name: Import the PowerDNS APT Repository key from File + apt_key: + data: "{{ lookup('file', pdns_install_repo['gpg_key']) }}" + id: "{{ pdns_install_repo['gpg_key_id'] | default('') }}" + state: present + when: not pdns_install_repo['gpg_key'] is regex("^[a-z]{3,}://") register: _pdns_apt_key - name: Add the PowerDNS APT Repository