From 50be7b35ec539b47421c358db564c907c8e1b988 Mon Sep 17 00:00:00 2001 From: Francisco de Freitas Date: Thu, 12 Jul 2018 17:31:12 +0200 Subject: [PATCH] allow to specify repository key + location --- README.md | 4 ++++ defaults/main.yml | 3 +++ tasks/Debian.yml | 19 +++++++++++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 008d9dd..0371905 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,10 @@ marathon_version: "1.3.6" # Debian: Mesosphere apt repository URL marathon_apt_package: "marathon={{ marathon_version }}-*" marathon_apt_repo: "deb http://repos.mesosphere.com/{{ansible_distribution|lower}} {{ansible_distribution_release|lower}} main" +marathon_apt_key_id: 'E56151BF' +marathon_apt_key_server: 'keyserver.ubuntu.com' +# undefined if using key server; if set, will override adding key from key_server above +marathon_apt_key_url: # Debian apt pin priority for the marathon package. If empty (the default), no pin priority is used. marathon_apt_pin_priority: diff --git a/defaults/main.yml b/defaults/main.yml index 654095c..f7a9ae5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -8,6 +8,9 @@ marathon_package_version: "1.0.540" marathon_os_distribution: "{{ ansible_distribution | lower }}" marathon_os_version: "{{ ansible_distribution_version.split('.') | join('') }}" marathon_apt_url: "http://{{ marathon_repo_host }}/{{ ansible_distribution | lower }}" +marathon_apt_key_id: 'E56151BF' +marathon_apt_keyserver: 'keyserver.ubuntu.com' +marathon_apt_key_url: marathon_package_full_version: "{{ marathon_version }}-{{ marathon_package_version }}.{{ marathon_os_distribution }}{{ marathon_os_version }}" marathon_apt_package: "marathon={{ marathon_package_full_version }}" diff --git a/tasks/Debian.yml b/tasks/Debian.yml index a639469..14e4442 100644 --- a/tasks/Debian.yml +++ b/tasks/Debian.yml @@ -1,6 +1,21 @@ --- -- name: Add apt-key - apt_key: id=E56151BF keyserver=keyserver.ubuntu.com state=present +- name: Add apt-key (keyserver) + apt_key: + id: "{{ marathon_apt_key_id }}" + keyserver: "{{ marathon_apt_key_server }}" + state: present + when: + - marathon_apt_key_id and marathon_apt_key_server + - marathon_apt_key_url is not defined + +- name: Add apt-key (url) + apt_key: + id: "{{ marathon_apt_key_id }}" + url: "{{ marathon_apt_key_url }}" + state: present + when: + - marathon_apt_key_id and marathon_apt_key_url + - marathon_apt_key_url is defined - name: Add Mesosphere repo apt_repository: repo='deb {{ marathon_apt_url }} {{ ansible_distribution_release | lower }} main' state=present update_cache=yes