Refactor signing key tasks (#105)

This commit is contained in:
Alessandro Fael Garcia 2019-02-19 16:30:10 +01:00 committed by Grzegorz Dzien
parent 469d663bc2
commit 8695f49f2b
2 changed files with 16 additions and 4 deletions

View File

@ -1,8 +1,14 @@
--- ---
- name: "(Install: APT OSs) Set Default APT NGINX Signing Key URL"
set_fact:
default_keysite: >-
{{ (ansible_distribution_release == 'trusty')
| ternary('http://nginx.org/keys/nginx_signing.key', 'https://nginx.org/keys/nginx_signing.key') }}
- name: "(Install: APT OSs) Set APT NGINX Signing Key URL" - name: "(Install: APT OSs) Set APT NGINX Signing Key URL"
set_fact: set_fact:
keysite: "{{ nginx_signing_key | default('http://nginx.org/keys/nginx_signing.key') }}" keysite: "{{ nginx_signing_key | default(default_keysite) }}"
- name: "(Install: APT OSs) Add APT NGINX Signing Key" - name: "(Install: APT OSs) Add APT NGINX Signing Key"
apt_key: apt_key:
url: "{{ keysite | default('https://nginx.org/keys/nginx_signing.key') }}" url: "{{ keysite }}"

View File

@ -1,8 +1,14 @@
--- ---
- name: "(Install: RPM OSs) Set Default RPM NGINX Signing Key"
set_fact:
default_keysite: >-
{{ (ansible_distribution_major_version|int == 6)
| ternary('http://nginx.org/keys/nginx_signing.key', 'https://nginx.org/keys/nginx_signing.key') }}
- name: "(Install: RPM OSs) Set RPM NGINX Signing Key URL" - name: "(Install: RPM OSs) Set RPM NGINX Signing Key URL"
set_fact: set_fact:
keysite: "{{ nginx_signing_key | default('http://nginx.org/keys/nginx_signing.key') }}" keysite: "{{ nginx_signing_key | default(default_keysite) }}"
- name: "(Install: RPM OSs) Add RPM NGINX Signing Key" - name: "(Install: RPM OSs) Add RPM NGINX Signing Key"
rpm_key: rpm_key:
key: "{{ keysite | default('https://nginx.org/keys/nginx_signing.key') }}" key: "{{ keysite }}"